Jump to content

About object movement on Z axis


photo

Recommended Posts

I would like to inform you that the below code is able to move the object on y and x direction but although I specify that it should move on the z-axis, it doesn't move on the z-axis.

Could you please tell me what is the reason and how should i solve it without changing the method.Also could you please give information about other methods of object movement.

Unigine::Math::Vec3 movexaxis = node->getWorldDirection(Unigine::Math::AXIS_X); //it moves on x axis as expected

Unigine::Math::Vec3 movezaxis = node->getWorldDirection(Unigine::Math::AXIS_Z); //but it does not work, the object does not move on z axis

int objectspeed = 30;
node->setWorldPosition(node->getWorldPosition()+movezaxis*objectspeed*Unigine::Game::get()->getIFps());//this is main function that should move on z axis but it does not work

 

Edited by burakdogancay
Link to comment

Hi burakdogancay,

I don't see any problems with your code. What type is the "node"? ObjectMeshStatic, PlayerActor, ObjectDummy? Is it physical (BodyRigid, Shapes)?
movezaxis is equal to zero? Look at it in debugger or send it to the engine's console:

Log::message("Movezaxis: %.3f, %.3f, %.3f\n", movezaxis.x, movezaxis.y, movezaxis.z);


Best regards,
Alexander

Link to comment

It returns this one 

Movezaxis: 0.000, -0.000, 1.000
Movezaxis: 0.000, -0.000, 1.000

But it does not move on this Z axis

HELICOPTER MOVEMENT 110.09 -674.877 20.8054 //20 is z axis pos
HELICOPTER MOVEMENT 110.09 -675.005 20.7984

 

Link to comment
×
×
  • Create New...