Character movement

I am trying to move a character based on the rotation of the camera like the camera can move around the character and I want “Vertical” to move forward (compared to the camera) no matter where the camera is, I want to know if anyone knows a function like transform.localposition.forward or something like that

That sir, was a terrible explanation. Can you give an example of a game that has a similar setup so I can better understand you?

Sorry legend I currently have a camera that orbits the character, I want the camera to always seem like it is at the back in terms of movement so example;
I have the camera at my back I can move forward and back with GetAxes(“Vertical”)
I rotate the camera 90 degrees
now GetAxes(“Vertical”) moves the character left right
I want to continue moving front back

Is that better?

is something like a 3d view controller, like resident evil ?..or like super mario 64…

i’m doing something like super mario, if i understood you well… you would use Camera relative coordinates,

function Update () {
var forward : Vector3 = Camera.main.transform.TransformDirection(Vector3.forward);
var right : Vector3 = Camera.main.transform.TransformDirection(Vector3.right);
var controller : CharacterController = GetComponent(CharacterController);
controller.Move(forward * 7);    // 7 is depending the value you want to give for speed..
controller.Move(right * 7);
}

Ahh, i see. Just add some code somewhere that copy’s the camera’s y rotation to the character object, something like:

function LateUpdate(){
    theCharacter.transform.rotation = Quaternion.Euler(0, theCamera.transform.eulerAngles.y, 0);
}

Then the camera will appear to always be “behind” him, because he will rotate to match the same forward heading as the camera (on the y axis).

Thanks Mig TransformDirection was what I was looking for Thanks legend for always trying to help me in spite of my poor communication skills

TranformDirection() doesn’t really do anything for you in this case; saying:

myCamera.transform.TransformDirection(Vector3.forward)

is the same as saying:

myCamera.transform.forward

transform.forward, transform.right and transform.up are built-in shortcuts to a transform’s local forward, right and up directions.

indeed are the same… is a shorthand way :slight_smile: