Rotation & angle of universal joint?

RE: Rotation & angle of universal joint?
#5
(2019-10-02, 3:36)N. W. Perry Wrote: Since I got such quick and helpful advice on my piston rod question, here is my next challenge: universal joints!

I don't have the time to go in to details at the moment, but you might want to look at my 8860 animation script (included in LDCad's examples).

It does realtime frame depended universal placements.

Code section of interest:

Code:
```    --The universal joints are a bit tricky and need some rotation matrix 'magic'.     -- As there are two of them a function can be used to apply things on both of them.     -- This uses the source's known local X and Z axis' to construct the link's orientation by using the also known destination Z-axis (axle length direction).     -- The orientation of the destination can then be constructed based upon the link's orientation.     -- We don't have to worry about positions in absolute model space as the aniTools joint mechanics will take care of that.     local function calcUniAxle(fromAxleOri, dstAxleZ, linkPosOri, dstAxlePosOri)       --link       local jntX=fromAxleOri:getOriRow(1)       local jntZ=fromAxleOri:getOriRow(3)       local jAngle=jntX:getSignedAngle(dstAxleZ, jntZ)       local ori=ldc.matrix()       ori:setRotate(jAngle, jntX)       jntZ:transform(ori)       local jntY=jntZ:getCross(jntX)       ori:setOriRows(jntX, jntY, jntZ)       ori:mulAB(fromAxleOri:getInvertedOri())       linkPosOri:set(ori)       --dst       jAngle=jntY:getSignedAngle(dstAxleZ, jntZ)       ori:setRotate(jAngle, jntY)       jntZ:transform(ori)       jntX=jntY:getCross(jntZ)       dstAxlePosOri:setIdentity()       dstAxlePosOri:setOriRows(jntX, jntY, jntZ)     end     local z=self.axle1Joint.orgAbsPosOri:getPos()-self.axle3Joint.orgAbsPosOri:getPos()     calcUniAxle(self.axle3PosOri.value, z, self.axleJnt2PosOri.value, self.axle2PosOri.value)     z=self.axle1Joint.obj:getOri():getOriRow(3)     calcUniAxle(self.axle2PosOri.value, z, self.axleJnt1PosOri.value, self.axle1PosOri.value)```
« Next Oldest | Next Newest »

 Messages In This Thread Rotation & angle of universal joint? - by N. W. Perry - 2019-10-02, 3:36 RE: Rotation & angle of universal joint? - by Philippe Hurbain - 2019-10-02, 11:33 RE: Rotation & angle of universal joint? - by Orion Pobursky - 2019-10-02, 14:05 RE: Rotation & angle of universal joint? - by N. W. Perry - 2019-10-05, 1:53 RE: Rotation & angle of universal joint? - by Orion Pobursky - 2019-10-05, 3:17 RE: Rotation & angle of universal joint? - by Philippe Hurbain - 2019-10-05, 7:47 RE: Rotation & angle of universal joint? - by Eugen - 2019-10-02, 13:55 RE: Rotation & angle of universal joint? - by Roland Melkert - 2019-10-02, 18:17 RE: Rotation & angle of universal joint? - by N. W. Perry - 2019-10-03, 1:47 RE: Rotation & angle of universal joint? - by Orion Pobursky - 2019-10-03, 2:57 RE: Rotation & angle of universal joint? - by Roland Melkert - 2019-10-03, 22:27 RE: Rotation & angle of universal joint? - by Philippe Hurbain - 2019-10-04, 7:23 RE: Rotation & angle of universal joint? - by Roland Melkert - 2019-10-04, 17:43 RE: Rotation & angle of universal joint? - by Philippe Hurbain - 2019-10-04, 18:09 RE: Rotation & angle of universal joint? - by Roland Melkert - 2019-10-04, 18:24 RE: Rotation & angle of universal joint? - by Philippe Hurbain - 2019-10-05, 11:58 RE: Rotation & angle of universal joint? - by Roland Melkert - 2019-10-06, 17:51 RE: Rotation & angle of universal joint? - by Philippe Hurbain - 2019-10-06, 18:18 RE: Rotation & angle of universal joint? - by Roland Melkert - 2019-10-06, 18:32 RE: Rotation & angle of universal joint? - by Philippe Hurbain - 2019-10-06, 19:02 RE: Rotation & angle of universal joint? - by Roland Melkert - 2019-10-06, 19:15 RE: Rotation & angle of universal joint? - by Philippe Hurbain - 2019-10-07, 6:57 RE: Rotation & angle of universal joint? - by N. W. Perry - 2019-10-04, 16:48 RE: Rotation & angle of universal joint? - by Roland Melkert - 2019-10-04, 17:46 RE: Rotation & angle of universal joint? - by N. W. Perry - 2019-10-04, 19:41 RE: Rotation & angle of universal joint? - by Milan Vančura - 2019-10-22, 9:01 RE: Rotation & angle of universal joint? - by Roland Melkert - 2019-10-22, 19:04 RE: Rotation & angle of universal joint? - by N. W. Perry - 2021-08-22, 17:09 RE: Rotation & angle of universal joint? - by Roland Melkert - 2021-08-23, 21:03

Forum Jump:

Users browsing this thread: 1 Guest(s)