christian.wolf2 Posted August 29, 2014 Share Posted August 29, 2014 Hi, I have some problems with rotating objects manually via Unigine Script and Game Framework. First my entity are moving to an DestinationPosition with following code: vec3 pawn_direction = DestinationPosition - curPosition; curRotation = lerp(curRotation,quat(setTo(Vec3_zero,pawn_direction,vec3(0.0f,0.0f,1.0f))),iFps * TurningSpeed); curPosition += normalize(pawn_direction) * iFps * MovementSpeed; PhysicalPawn.setWorldTransform(translate(curPosition) * curRotation); No problem with that. After my entity is reaching the DestinationPosition, they should rotate to an DestinationRotation which is of type quat(0.0f,0.0f,1.0f,destination_angle). But after a long try and error I can't get the right solution to get working. I tried following code from the samples/objects/mesh_01: PhysicalPawn.setWorldTransform(Mat4(PhysicalPawn.getWorldTransform() * quat(0.0f,0.0f,0.0f,ifps * TurningSpeed))); and from samples/materials/2d_00: PhysicalPawn.setWorldTransform(PhysicalPawn.getWorldTransform() * Mat4(rotateZ(ifps * TurningSpeed))); All without any success. What I'm doing wrong? PhysicalPawn is of type PlayerActor. Ist that my problem? If anyone can get me just a hint it will be much appreciated. Thanks. Link to comment
silent Posted August 29, 2014 Share Posted August 29, 2014 Hi Christian, Coud you please provide minimal working test scene for reproduction? Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Recommended Posts