Hey guys, so I’ve been trying to figure out how to implement ground hugging.
Which is basically having the player model’s down vector always facing the ground.
I’ve been trying to do it using the entity’s lookAt function gathering the ground normal etc but I haven’t been able to correctly do this.
In Unity, I’ve made it several times using Quaternion.LookRotation and making a Cross product but I don’t know what would be the equivalent in PlayCanvas.
Here’s a few very poor 2D illustrations of what I’m trying to do;

And here’s the Unity thread that helped me through the problem back in the day (however I’ve had no luck translating this to JS):
https://answers.unity.com/questions/168097/orient-vehicle-to-ground-normal.html