Frederik Petri
Frederik Petri

Reputation: 481

How to rotate skeleton segments in Three JS skinning example?

I would like to use this Three JS example in my project. But I have my own dataset of movements I would like to implement, consisting of quaternion rotations of each segment (hands, arms, trunk...). However, I am new to using Three JS and JavaScript in general. Can I access the skeleton parts in

skeleton = new THREE.SkeletonHelper( model );

and apply the rotations? and how?

E.g. I would like to apply the following rotation to the elbow joint:

quat = [0.5412077307701111,-0.5664581656455994,-0.34294596314430237,-0.5182857513427734]

enter image description here

Upvotes: 0

Views: 697

Answers (1)

Masilila
Masilila

Reputation: 524

You can apply the following code to get the specific joint and then apply the quaternion as so:

rightArm = model.getObjectByName( 'mixamorigRightArm' );


rightArm.quaternion.set(w,x,y,z);

Upvotes: 1

Related Questions