Haxe - How to Rotate Third Person Controller

Hi guys!
I’m modifying the bundled third person controller haxe script. I’m trying to rotate the character using transform.rotate but it’s not rotating at all… can anyone help me with this?

Could you show your code? I literally just did this 2 days ago :slight_smile: :

var mouse = Input.getMouse();
cameraPivot.transform.rotate(xVec, mouse.movementY / 100 * rotationSpeed);
object.transform.rotate(zVec, -mouse.movementX / 100 * rotationSpeed);
body.syncTransform();

Make sure you do the body.syncTransform(), otherwise the RigidBody simulator won’t apply your manually adjusted transformation. I’ve also found that if it isn’t a RigidBody I sometimes need to do a object.transform.buildMatrix() after manually adjusting the transform properties like loc. I think it essentially “applies” what changes you made to the properties like rot, or loc.

1 Like