I want to instantly rotate one object towards the position of the other. I have this code:
public GameObject Object1, Point1;
Object1.Transform.LookAt(Point1);
And it doesn’t work.
I want to instantly rotate one object towards the position of the other. I have this code:
public GameObject Object1, Point1;
Object1.Transform.LookAt(Point1);
And it doesn’t work.
Try this: look at constraints
I see two problems: First, you have “transform” capitalized in “Object1.Transform”. Generally speaking, Unity’s built-in classes capitalize their method names but not their object properties. So, it should be Object1.transform.LookAt. The second thing is that the LookAt method takes a Transform as a parameter, not a GameObject. So, make it Object1.transform.LookAt(Point1.transform).
Stuff like this should be displaying error messages in the console. If you’re not checking the console whenever things fail to work, you really should be. It’s a lot faster than posting stuff to the help forum.