setObject moving different than commanded
Posted: 30 May 2021, 01:56
Hi there.
I have a model which should move according to directions passed by Serial or keyboard commands, going foward, backward and turning left or right.
The thing is when it moves related to the global parameters:
sim.setObjectOrientation(handle,-1,{x, y, changeZ})
sim.setObjectPosition(handle,-1,{changeX, y, z})
After turning, the position is still related to the global parameters, moving sideways, when it should go foward and facing the front of the model.
Then I tried moving it related to itself:
sim.setObjectOrientation(handle, handle, {x, y, changeZ})
sim.setObjectPosition(handle, handle,{changeX, y, z})
This way the model started moving up like there was a ramp to the sky even though I'm only changing position on the x-axis and orientation turning on the z-axis.
I don't understand why this is happening. I would appreciate some help.
Thanks
I have a model which should move according to directions passed by Serial or keyboard commands, going foward, backward and turning left or right.
The thing is when it moves related to the global parameters:
sim.setObjectOrientation(handle,-1,{x, y, changeZ})
sim.setObjectPosition(handle,-1,{changeX, y, z})
After turning, the position is still related to the global parameters, moving sideways, when it should go foward and facing the front of the model.
Then I tried moving it related to itself:
sim.setObjectOrientation(handle, handle, {x, y, changeZ})
sim.setObjectPosition(handle, handle,{changeX, y, z})
This way the model started moving up like there was a ramp to the sky even though I'm only changing position on the x-axis and orientation turning on the z-axis.
I don't understand why this is happening. I would appreciate some help.
Thanks