Home Game Development unity – How to rotate two transforms to the touch at a degree, whereas preserving ahead course?

unity – How to rotate two transforms to the touch at a degree, whereas preserving ahead course?

0
unity – How to rotate two transforms to the touch at a degree, whereas preserving ahead course?

[ad_1]

I’ve a rework which I have to level one in every of its axes within the course of one other sport object, with out disturbing or rotating the opposite axes in any manner.

Consider 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

In this picture, each T1 and T2 have to face the controller anyplace it strikes with out spinning on their Up axis, which means their ahead axis should all the time stay ahead.

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

The downside I’m dealing with comes all the way 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 appropriate course alongside the Z and X axes whereas ignoring the Y. It is all the time 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 have to lock it to face ahead, however tilt facet to facet and forwards and backwards.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here