- Home /
How can I get the rotation of an object to corresspond with the y transform of another?
As of right now I have a pretty basic script. (I just realized I misspelled missile lol)
void ConfigureIndicator()
{
if (activeMissle != null && activeMissle.gameObject.transform.position.y > 7)
{
missleIndicatorPlaceholder.transform.localEulerAngles = new Vector3(0, 0, -15f);
}
else if (activeMissle != null && activeMissle.gameObject.transform.position.y < 7)
{
missleIndicatorPlaceholder.transform.localEulerAngles = new Vector3(0, 0, 15f);
}
}
It definitely works pretty primitively & and at the very least instead of an arrow I could just change it to something else and have it appear when missiles spawn. I would like it to be a bit more interactive though, as of right now it just switches if the missile gets higher or lower. I tried using Mathf.Clamp(). But either it wasn't super effective or I simply wasn't using it correctly (I have used the method before so I am aware of how to use it). I just couldn't the the rotation to accurately line up with the y value of the missile. Any help would be greatly appreciated.
Your answer
Follow this Question
Related Questions
How to zoom in line renderer using the camera 1 Answer
Make my mathf to Wait? :) 2 Answers
How to add a score value smoothly ? 3 Answers
Whole number Mathf.SmoothDamp ? 1 Answer
How do i fix this problem? 1 Answer