here is link with full code
https://jsfiddle.net/g2e8n5bu/
my animation does not play
It works if you donāt use SkeletonUtils.clone()
in your player class to clone a scene object. This method is intended for skinned meshes.
Itās also recommended to call AnimationAction.play()
only once and not per frame.
https://jsfiddle.net/un64t53L/
The problem with cloning is that the animation
thank you, i just want make small game.
i tought for performance reason i clone mesh, because each time player connects should create new mesh of robot ?
In general, cloning is the correct approach for this use case. I am also seeing now that you adapt the code of this example:
https://threejs.org/examples/#webgl_animation_multiple
However, the robot is no part of it. There could be a problem with the structure of the asset which produces a problem when cloning is performed or when you create the instance of AnimationMixer
.
even if i clone, i console logged player.animmations, there are animations, but they do not play for some reason
I think the problem is that the robot consist of four separate skinned meshes whereas the example only uses models with a single skinned mesh. You can verify the amount of skinned meshes here:
ahh okey, i just been trying to do same thing as you did in https://github.com/Mugen87/dive/blob/292796446f4c80067c0d2c49ad1f36202c0b7e27/src/core/AssetManager.js
i just do not understand how you handle events on playing animation when player runs left or right, jumps etc.
This is done in the following method:
Itās important to understand that the routine does not playback just a single animation. Instead, the code computes a weighting for an active set of animations based on the game entitieās velocity and look direction. In this way, the movement animation is more natural and you never have a sudden change from letās say move forward to move right.
thank you so much
i have question, i just loaded the model (āsoldierā) from Dive, the soldier is very small, do i need to scale the model or i need to zoom in camera to the model ?
i just copied camera from Dive
camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 0.1, 1000 );
camera.position.set( 0, 45, 150 );
The camera is too far away^^. The code above represents the spectator settingsā¦
what should it be then ?
Well, this depends on your use case. Maybe do it like in this example:
https://threejs.org/examples/webgl_animation_skinning_blending
ok i will try it
well it is due of weights because
Uncaught TypeError: transformedDirection.copy(ā¦).applyRotation is not a function
transformedDirection.copy( directions[ i ].direction ).applyRotation( quaternion );
const dot = transformedDirection.dot( lookDirection );
dot is always 0, thats why my weights do not change
hey, i tried this exemple that you linked,
but
mixer.addEventListener( āloopā, onLoopFinished ); it says it is undefined
here is link
https://jsfiddle.net/yte49bgf/6/
Um, Iām not seeing a runtime error causes by an undefined variable in the browser console.
mixer.addEventListener( āloopā, onLoopFinished );
this does not work
console.log(mixer.addEventListener(āloopā, onLoopFinished )) is undefined