I have a vector pointing the direction my object should be pointing. How can I set the rotation for this object so that it points in the same direction as the vector?
Here is an example:
The cube must be point in the same direction
I imagine it to be a trivial question, but I’m messing around here with those rotations
I’ve translated the code to playcanvas, but it creates a distorted rotation and not what i need. To contextualize, i have an program that need to do a raycast at an object, and at the raycast point, create an object with normal direction of this point.
Here’s an example of setting the forward direction of an entity to look in the direction of the normal on the intersection point of a raycast: https://playcanvas.com/editor/scene/605466
This is from copying the lookAt code that I linked to earlier.
Great thanks! As far I’ve seen the official example doesn’t have the part that sets the rotation of the entity the same as the normal of the hit result.