Hello everyone.
I'm trying to make the dummy object following the path and failing to set object orientation coordinate (rotation around Z). I'm using getOrientationOnPath and using one of the axis rotation value to rotate my object around Z. For some reason on some parts of the path I get wrong orientation like this:
https://drive.google.com/file/d/10McXMr ... sp=sharing
What could be a problem?
https://drive.google.com/open?id=1xjxd- ... DsOpMP1ecd
Orientation on path
Re: Orientation on path
Hello,
the problem is how Euler angles work. Most of the time, you cannot simply consider one Euler angle alone.
Try instead something like:
Cheers
the problem is how Euler angles work. Most of the time, you cannot simply consider one Euler angle alone.
Try instead something like:
Code: Select all
position = sim.getPositionOnPath(path,l)
position[3] = 0
pathOrientation = sim.getOrientationOnPath(path,l)
newObjectOrientation = pathOrientation
local m=sim.buildMatrix(position,newObjectOrientation)
m=sim.rotateAroundAxis(m,{m[2],m[6],m[10]},position,math.pi/2)
m=sim.rotateAroundAxis(m,{m[3],m[7],m[11]},position,math.pi)
sim.setObjectMatrix(object,-1,m)
Re: Orientation on path
Code: Select all
local m=sim.buildMatrix(position,newObjectOrientation)
m=sim.rotateAroundAxis(m,{m[2],m[6],m[10]},position,math.pi/2)
m=sim.rotateAroundAxis(m,{m[3],m[7],m[11]},position,math.pi)
As far as I understand in 1st line we build rotation+translation matrix based on Euler angles and position.
In 2nd/3rd lines we rotate this around vectors that consist of 2nd/3rd column of this matrix. What meanings do these vectors have?
Re: Orientation on path
In a transformation matrix, the first column corresponds to the X-axis of the transformation frame. The second column is the Y- and the third column is the Z-axis.
So basically, we rotate the frame around its own axes.
Cheers
So basically, we rotate the frame around its own axes.
Cheers