Answer the question
In order to leave comments, you need to log in
How to rotate an object so that its top part points to another object?
How to rotate an object so that its top part points to another object?
Answer the question
In order to leave comments, you need to log in
Alternatively, use the LookAt method from Unity. But, it will allow you to look at the face of the object, where the face is on the X axis. This is corrected as follows ...
We use the main (parent) object as a shell, we put the object we need in it, which becomes a child. We put the parent object in the inspector in _listener. Since the method provides the ability to look along the X-Axis, we turn the child object to the desired angle so that its top is along the X-Axis of the parent.
[SerializeField] private GameObject _listener;
[SerializeField] private GameObject _riecever;
void Update()
{
_listener.transform.LookAt(_riecever.transform);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question