Hi,
I'm in desperate need of some math help...
I have a HINGE JOINT along the X-axis (1,0,0) and uses the Lo-Stop/Hi-Stop constraints set to -1.0*pi and +1.0*pi.
This works fine, but at a certain point I need to re-set the joint (for example after the object has been moved in the editor, or a level is re-loaded). So I need to reset the joint's position and rotate it's axis relatively to the object. I use the following code - which works perfectly fine:
Since the axis is no longer aigned at 1,0,0 the lo/histop values -1*pi and +1*pi won't give the same result ie. they need to be 'rotated' as well.
So I guess I have to rotate the axis-vector by the original lo/histop values to get the new lo/histop values. But rotating vectors around their axis and mixing degrees and pi's and.. Sorry, I have no cue how to do this! :)
Any help greatly appreciated!
Danny
I'm in desperate need of some math help...
I have a HINGE JOINT along the X-axis (1,0,0) and uses the Lo-Stop/Hi-Stop constraints set to -1.0*pi and +1.0*pi.
This works fine, but at a certain point I need to re-set the joint (for example after the object has been moved in the editor, or a level is re-loaded). So I need to reset the joint's position and rotate it's axis relatively to the object. I use the following code - which works perfectly fine:
;reposition joint with offset relative to mesh's current position & rotation ;---------------- TFormPoint xOffset#,yOffset#,zOffset#, mesh, 0 dJointSetHingeAnchor joint, TFormedX#(),TFormedY#(),TFormedZ#() ;re-align the joint's axis (Hinge along X axis) relative to mesh's current rotation ;---------------- ax# = 1.0 ay# = 0.0 az# = 0.0 TFormNormal ax#,ay#,az#, mesh, 0 dJointSetHingeAxis joint, TFormedX#(),TFormedY#(),TFormedZ#()BUT then I realised that the Joint's LO-STOP and HI-STOP values need to be adjusted as well!! To compensate for the Joint's Axis rotation!
Since the axis is no longer aigned at 1,0,0 the lo/histop values -1*pi and +1*pi won't give the same result ie. they need to be 'rotated' as well.
So I guess I have to rotate the axis-vector by the original lo/histop values to get the new lo/histop values. But rotating vectors around their axis and mixing degrees and pi's and.. Sorry, I have no cue how to do this! :)
Any help greatly appreciated!
Danny