Face to direction, in a Mario Galaxy style game?

Hello guys, I’m developing a game that uses the mechanics of planets similar to Mario Galaxy.

But I’m having trouble to set a character’s face in his direction. I’m trying hundreds of ways, but they all reset values ​​of the X and Z axes, leaving the character in a plan, when in reality it is over a sphere (planet) and its Y axis is always recalculated.

Follow what I’m trying right now, for example, direct face-to-left:

private void MovementUpdate () {
	var _hor = Input.GetAxis("Horizontal");
	var _ver = Input.GetAxis("Vertical");
    var _localUp = transform.worldToLocalMatrix.MultiplyVector(transform.up);
	var _localRight = transform.worldToLocalMatrix.MultiplyVector(transform.right);
	var _localForward = transform.worldToLocalMatrix.MultiplyVector(transform.forward);

    //Face to left
    if (_hor < 0) {
        var _rotation = Quaternion.LookRotation(-_localRight, _localUp).eulerAngles;
	    transform.Translate(_localForward * Speed * Time.deltaTime, Space.Self);

Any help is very welcome, and sorry for my english…

A number of issues here. In order to move forward on a sphere, you want to rotate around an axis through the sphere, not Translate(). Also Local coordinates for Up, Right, and Forward will always be (0,1,0), (1,0,0), and (0,0,1) respectively. So you don’t have to do the calculation to bring world to local coordinates using the world up/right/forward. Here is a simple script that walks an object along the surface of a sphere:

 #pragma strict

	var planet : Transform;
    var speed = 25.0;
    var rotateSpeed = 45.0; 

    function Update() {
    	var horz = Input.GetAxis("Horizontal");
    	var vert = -Input.GetAxis("Vertical");
        transform.RotateAround(planet.position, transform.right,speed * Time.deltaTime * vert); 
        transform.Rotate(0.0, rotateSpeed * Time.deltaTime * horz, 0.0);

The character this script is attached to should be setup so that it is standing on the sphere with it’s forward facing along the surface of the sphere.