Hi, bad news, the newton mod release will be delayed due some rotation problems I have.
I think this is a thing only simon can answer.
My problem is I'm using these 2 function to generate the rotation in eulers for updating the newtonobjects:
[code]
Function Max3DGetMatrix(Node:TNewtonObject , NewtonMat:Float Ptr)
Local Euler:Float[3]
Euler[0] = Node.rotX * Pi / 180.0
Euler[1] = Node.rotY * Pi / 180.0
Euler[2] = Node.rotZ * Pi / 180.0
NewtonSetEulerAngle(Varptr Euler[0] , Varptr newtonMat[0])
Newtonmat[12] = Node.PosX
newtonMat[13] = Node.PosY
NewtonMat[14] = Node.PosZ
End Function
Function Max3DSetMatrix(Node:TNewtonObject , NewtonMat:Float Ptr)
Local Euler:Float[3]
NewtonGetEulerAngle(Varptr NewtonMat[0] , Varptr Euler[0])
Node.Posx = NewtonMat[12]
Node.Posy = NewtonMat[13]
Node.Posz = NewtonMat[14]
Node.rotX = Euler[0] * 180.0 / Pi
Node.rotY = Euler[1] * 180.0 / Pi
Node.rotZ = Euler[2] * 180.0 / Pi
End Function
[/codebox]
I was thinking everything works fine until ihave implemented the debug routines (viewing the real hull rotation ), but the rotation is slightly wrong, sometimes the rotation works, sometimes not. espacially after some time the rotation seems to swap complete the direction when it shouldn't. (You will notice this in my latest video). Any ideas why this is happening?
If it is needed I will post more code or will release the not properly working mod. But I wish someone could point me to the right direction.
thx klepto2
I think this is a thing only simon can answer.
My problem is I'm using these 2 function to generate the rotation in eulers for updating the newtonobjects:
[code]
Function Max3DGetMatrix(Node:TNewtonObject , NewtonMat:Float Ptr)
Local Euler:Float[3]
Euler[0] = Node.rotX * Pi / 180.0
Euler[1] = Node.rotY * Pi / 180.0
Euler[2] = Node.rotZ * Pi / 180.0
NewtonSetEulerAngle(Varptr Euler[0] , Varptr newtonMat[0])
Newtonmat[12] = Node.PosX
newtonMat[13] = Node.PosY
NewtonMat[14] = Node.PosZ
End Function
Function Max3DSetMatrix(Node:TNewtonObject , NewtonMat:Float Ptr)
Local Euler:Float[3]
NewtonGetEulerAngle(Varptr NewtonMat[0] , Varptr Euler[0])
Node.Posx = NewtonMat[12]
Node.Posy = NewtonMat[13]
Node.Posz = NewtonMat[14]
Node.rotX = Euler[0] * 180.0 / Pi
Node.rotY = Euler[1] * 180.0 / Pi
Node.rotZ = Euler[2] * 180.0 / Pi
End Function
[/codebox]
I was thinking everything works fine until ihave implemented the debug routines (viewing the real hull rotation ), but the rotation is slightly wrong, sometimes the rotation works, sometimes not. espacially after some time the rotation seems to swap complete the direction when it shouldn't. (You will notice this in my latest video). Any ideas why this is happening?
If it is needed I will post more code or will release the not properly working mod. But I wish someone could point me to the right direction.
thx klepto2