I have a scene with two objects (browser) and (player_1).
the navigator can scroll through all the scenes and control it with the keys A, S, D, W.
What I want is for player_1 to look in the direction the browser is in!
so I did it
var angle = Math.atan2 (browser.position.z - player_1.position.z, browser.position.x - player_1.position.x); angle = angle * (180 / Math.PI); player_1.rotation = new BABYLON.Vector3 (0, angle, 0);
player_1 spins but the front of the character never faces the position - I think it can be quaternion.
I tried running the player_1 in a simple way too and to my surprise, it spins wrong. (For example
player_1.rotation = new BABYLON.Vector3 (0, 90, 0);
when I press a button, it turns but it does not make 90 degrees before doing more than that.
The idea is that every time I select a location with the browser, player_1 goes back to that location.
Hi, I’ll try this and nothing.
player_1.rotationQuaternion = new BABYLON.Quaternion.RotationAxis (BABYLON.Axis.Y, angle);
I hope, thank you! xD