Hi, I’m trying to make a game control like Mario Galaxy. The player is placed and correctly oriented in a sphere using Ray picking and the Quaternion.FromToRotation function. But do not quite understand how I can add the rest of rotations to control the player (turn left and turn right). How I can add these rotations correctly?. I have tried several things but have not gotten it to work. Thank you very much.
//This script is applied to the player's GameObject
function Update(){
var rayHit : RaycastHit;
var ray = new Ray (transform.position, -transform.up); //vertical ray
if (Physics.Raycast (ray, rayHit , Mathf.Infinity)){
//placing player
transform.position = hit.point;
//rotating the player
var hitRotation = Quaternion.FromToRotation(Vector3.up,rayHit.normal);
transform.rotation = hitRotation;
}
}