问题
I have two objects, let's call them nearObject and farObject. Once nearObject gets within a certain distance from farObject, I want farObject to rotate to face nearObject. This should happen instantly, it does not need to slowly rotate over time.
1) The distance is arbitrary, so I am using the following to get distance information. nearObject.position.distanceToSquared(farObject.position);
2) Now I want farObject to rotate perpendicular to the vector between the two objects. What is the easiest way to do this?
回答1:
farObject.lookAt( nearObject.position );
来源:https://stackoverflow.com/questions/11440337/point-one-object-to-face-a-distant-object