Friday, October 7, 2022
HomeGame Developmentunity - Tips on how to rotate two transforms to the touch...

unity – Tips on how to rotate two transforms to the touch at some extent, whereas preserving ahead route?


I’ve a remodel which I must level one among its axes within the route of one other sport object, with out disturbing or rotating the opposite axes in any manner.

Think about the way in which your hips transfer round on a horizontal aircraft, whereas each your higher and decrease physique rotate to face the hip bone’s place, with out turning left or proper.

See the waist

How do I obtain the above utilizing Unity transforms in C#?

Controller is moving only on a horizontal plane. T1 and T2 need to point towards this without changing its front facing direction

On this picture, each T1 and T2 must face the controller anyplace it strikes with out spinning on their Up axis, which means their ahead axis should at all times stay ahead.

Whereas reviewing my query I see Billboarding as a suggestion. I’m asking how one can billboard each T1 and T2 to the controller with out turning their ahead instructions.

The issue I’m going through comes right down to the three axes. If I apply LookAt() to the controller, even when setting the x, y, or z, or each xz or xy or zy to 0, there isn’t any manner that LookAt() can level T1 in the suitable route alongside the Z and X axes whereas ignoring the Y. It’s at all times Z rotation solely or X rotation solely or undesired Y turning because the outcome. LookAt is inflicting the entrance of the physique to face away from the entrance when the controller strikes, I must lock it to face ahead, however tilt facet to facet and forwards and backwards.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments