Added debug bool
Used to enable spamming of the player position in the browser console
This commit is contained in:
@@ -6,6 +6,8 @@ import * as Animations from './utils/animateMesh.js';
|
|||||||
let Clock = new THREE.Clock();
|
let Clock = new THREE.Clock();
|
||||||
THREE.Cache.enabled = true;//So we can request several time the same file without worrying : https://threejs.org/docs/#api/en/loaders/FileLoader
|
THREE.Cache.enabled = true;//So we can request several time the same file without worrying : https://threejs.org/docs/#api/en/loaders/FileLoader
|
||||||
|
|
||||||
|
const APP_DEBUG = false;//Turn true to show player position in browser console
|
||||||
|
|
||||||
/* --------------------- */
|
/* --------------------- */
|
||||||
/* | SCENE CREATION | */
|
/* | SCENE CREATION | */
|
||||||
/* --------------------- */
|
/* --------------------- */
|
||||||
@@ -38,6 +40,8 @@ Animations.addAnimationMixerOnMesh(assets.player, ["Walk"]);
|
|||||||
function animate() {
|
function animate() {
|
||||||
requestAnimationFrame( animate );
|
requestAnimationFrame( animate );
|
||||||
|
|
||||||
|
if(APP_DEBUG)console.log("Player position X : "+assets.player.scene.position.x+ " Y : "+assets.player.scene.position.y);
|
||||||
|
|
||||||
PlayerMovement.updatePlayerPositionAnimation(assets.player, camera, scene);//Updating player position and rotation
|
PlayerMovement.updatePlayerPositionAnimation(assets.player, camera, scene);//Updating player position and rotation
|
||||||
Animations.updateAnimations(Clock.getDelta());//Playing animations
|
Animations.updateAnimations(Clock.getDelta());//Playing animations
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ export function handleKeyDown(event) {
|
|||||||
for(let i=0; i<intersects.length; i++){
|
for(let i=0; i<intersects.length; i++){
|
||||||
if(intersects[i].distance>collisionThreshold && intersects[i].distance<allowedDistance){
|
if(intersects[i].distance>collisionThreshold && intersects[i].distance<allowedDistance){
|
||||||
//Valid colliding object, not too close ( player leg / arm ), but not too far
|
//Valid colliding object, not too close ( player leg / arm ), but not too far
|
||||||
console.log(intersects[i]);
|
|
||||||
playerDirection.set(0, 0, 0);
|
playerDirection.set(0, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user