Reputation: 95
I have 6 models - one placed by the player and the rest scattered around it randomly. Currently all the models are "looking" in one direction, but I want the scattered models to be rotated so they "look" at the central model. How do I do it?
(I've tried using Quartenion.axisAngle)
Upvotes: 3
Views: 117
Reputation: 89
Try with Quaternion.lookRotation() like below.
val direction = Vector3.subtract(SCATTERED_MODEL.worldPosition, CENTRAL_NODE.worldPosition)
SCATTERED_MODEL.worldRotation = Quaternion.lookRotation(direction, Vector3.up())
Upvotes: 1