Fixed top down camera, and character rotation

Hi .

Probably a simple problem, yet i can’t get a solution.

Imagine a tennis game, fixed top-down camera. My input are always relative to world space, so my character goes up / down and left / right on the court (relative to the camera), but it always face the right side of the court (east). I want it to face the direction it is moving to.

I used the “get last movement input vector”, it successfully make him face the direction of its movements BUT as soon as there is no more input, as soon it stop, it just faces again the right side of the court. (east)

How can I get it to keep his last rotation ? Maybe few tweak would do or maybe i should change the whole.

Thanks

Store a local vector and keep updating it as your inputs fire. Then use that direction to set the orientation. That way it wont reset.

Hth

Ho, I understand why this should work. The local vector should not be updating as no input are fired. So I tried, but it doesn’t work and the vector get reset anyway. Maybe my flow is bad.

Okay, might I found a way, it does keep the orientation vector, But because of the way i test “is different =!= 0.0,0.0” it doesn’t allow to remember any of the four corners direction to be set in the variable. Getting close tho.

EDIT :

Better way to test if the orientation is different than 0,0
Works.

To be honest I dont understand what you try to achieve with the first part of the sequence. You dont need that at all I think. That is where the problem is and that is why I said you should just update it without doing the check there.