1

So i am simulating a foreward kinematic chain in Three.js. The chain contents of cylindrical joints and static links inbetween. The links are static and should only be rotated and translated according to the kinematics. I get displacement matrices M with some rotation and a positional vektor for the joints. The displacement matrix determines also the rotation and position of the following joints, but you have to add the cylindrical rotation and translation for the joint to be in the correct place.

function updateLink(link, jointAxis, trans, rot_3, rotOffset, transOffset){

  pre_link = new Object3D()
  pre_link = link.clone()    //use the old link from zero configuration
  pre_link.matrix.setFromMatrix3(rot_3)  // change the position and rotation due to
                                         // movement of the chain
  pre_link.matrix.setPosition(trans)
  pre_link.matrixAutoUpdate = false;

The translation is just the translational offset along the joint axis(which is nomalized) :

trans = anchor + transOffSet * jointAxis

https://i.stack.imgur.com/Ni5Xb.png

Now the link is at the bottom of the joint, but it needs to get rotated around the joint axis to get in place, while not effecting the rotation and translation it got from the displacement matrix. I tried out a bunch of things , iE that i add the joint to the cylinder and then rotate the parent:

cylinder.add(link)
cylinder.rotateOnAxis(jointAxis, rotOffset)

With this code, the link gets rotated around an axis that goes through the origin, but i want to rotate around general lines not going thorugh the origin. (The cylinder up Axis, which is some kind of normalized vector at a certain point in the coordinate system.) Any help or ideas would be much aprreciated.

Raaquu
  • 11
  • 2
  • Perhaps this is helpful: https://stackoverflow.com/a/32038265/1461008 – WestLangley Oct 18 '22 at 19:47
  • @WestLangley yes, this function is very helpful, thanks. But since I have set `matrixAutoUpdate = false` , it does nothing to the Object if I dont call `matrixUpdate()`. When calling `matrixUpdate()`, it recalculates the position as well and the links get displaced. Is there a way where i can only update the rotational part of the matrix? – Raaquu Oct 20 '22 at 06:32

0 Answers0