Transform Direction situation

Hi all!

I have the current situation where I do a similiar job as of MouseOrbit but using iPad´s touches to rotate the camera. There is also a script where the object controlled by the player always receives forces (with AddForce) relative to camera´s TransformDirection.

This is my solution but it is also my problem. When the camera is rotated in a descending/ascending angle, any movement of that other object is slowed down because it´s trying to go downward. Also, in the same angle, if the player moves back, the object receives force to go up.

Limiting the camera rotation on z axis would reduce the effect of this problem, but it would still happens.

Any ideas?

Thanks!

1 Answer

1

Normalize the force direction to be aligned with the ground, not the camera. If you show the line where you add force and describe how the camera relates, I can probably explain that more precisely.

Thanks, Allison. I´ve solved the problem with a very simple step... I can´t believe I spent yesterday´s afternoon and half of today´s morning on this... By the way, your suggestion is also part of the solution but I can´t align to the ground alone or I won´t have the correct facing anymore.

If possible, post your own answer, as other people will come across your question in the future (but I'm anyway glad to hear you solved it).