R
R
Remo Williams2015-09-25 18:19:40
Game development
Remo Williams, 2015-09-25 18:19:40

How to implement a 180 degree character rotation in Torque 3d?

Please help to implement the character reversal. Suspecting that it is necessary to edit the game\scripts\client\default.bind.cs file. But what values ​​to set there, I can not imagine. The maximum he has achieved is that he makes a turn to the right by an insignificant value of a degree (barely noticeable).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
patch1, 2015-09-28
@RemoWilliams

A simple way to do this is the player transform.
Get player rotation or transform and do rotation +-180 degrees.
Torque script step in radians, you can have a value between 0 and 2PI.
Conversion help: (equivalence decimal)
0 radians = -2PI radians.
PI radians = -3PI/2 radians.
example: (z 180 degree rotation)
%objTransform = %object.getTransform();
%tryRotation = "0 0 0 0 0 1 " @ mDegToRad(180);
%newTransform = matrixMultiply(%objTransform, %tryRotation);
%object.setTransform(%newTransform);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question