Is there a command or does anyone how to take a vector from one object (Camera) and transform it into another object local space?
I used to use a command set like this.
TFormvector( X,Y,X, From Object, To Object)
X1=TFormedX()
Y1=TFormedY()
Z1=TFormedZ()
Thanks for any help,
Eric
A quick google will show the results you need… you should try google some time… its quite useful
https://www.google.co.nz/search?q=Unity+world+to+local&aq=f&oq=Unity+world+to+local&sourceid=chrome&ie=UTF-8
the first link, will no surprise, take you to the unity docs…
scanning down the page, you will notice functions for transforming world to local space.
I did search google but couldn’t form my question properly. My First post and I get slammed. 
My Question is how to go from an object transform to another Objects Transform. or from Camera Space to another GameObjects space.
What I’m trying to do is control a hovercraft. I’m tipping it forward and backwards, front to back and I’m creating thrust from below.
I’m controlling the ship from a joystick(Game pad).
Everything seems good until my camera angle changes.
This is a little of my crazy code.
void Update ()
{
ZZ=Input.GetAxis("Horizontal");
XX=-Input.GetAxis("Vertical");
Thrust=(Input.GetAxis("Thruster")*5.00f);
cameraRelative= Cam.transform.InverseTransformDirection(ZZ, 0, XX);
}
void FixedUpdate ()
{
rigidbody.AddRelativeForce(Vector3.up*Thrust,ForceMode.Impulse);
rigidbody.AddForceAtPosition( new Vector3(cameraRelative.x*ControlThrust,cameraRelative.y*ControlThrust,-cameraRelative.z*ControlThrust),transform.position + new Vector3(0.0f,0.625f,0.0f),ForceMode.Force);
rigidbody.AddForceAtPosition( new Vector3(-cameraRelative.x*ControlThrust,cameraRelative.y*ControlThrust,cameraRelative.z*ControlThrust),transform.position + new Vector3(0.0f,-0.625f,0.0f),ForceMode.Force);
}
yes I was perhaps a little harsh…
It might be easier if you don’t relate the movement to the camera. Is there a particular reason you are doing it this way?
why do you have multiple accounts?
also, controlling from a joystick is a terrible answer.
Your vehicle controller should be completely separated from your camera controller
The camera follows the ship around. In a fixed distance orbit of sorts… As the ship passes the camera the camera rotate to face the ship and also maintains a fixed distance. If the ship flies toward the camera the camera moves to keep a fixed distance a rotates in the orbit
The camera follow routine is not started but I’ve written it in other engines.
If my ship starts to rotate on the y axis my controls get all screwed up.
Think of a rocket and I want to tip the rocket along the X and Z Axis. The Game pad forward should translate from my current view and tip the Rocket away from the camera. Game Pad Back should tip the Rocket towards the camera…
The Rocket is free to spin on it’s Y Axis so the forces I apply have to be transformed from camera space to Rocket Space.
It’s really hard to type what I’m trying to do I hope this makes a little sense.
Here is a video of something I was working on last year.
http://www.youtube.com/watch?v=OrrbvBKZkKk
Now youre just not making any sense at all…
“The camera follows the ship around. In a fixed distance orbit of sorts…”
totally contradicts the second part…
“As the ship passes the camera the camera rotate to face the ship and also maintains a fixed distance.”
how exactly does a ship pass through a camera that is following the ship?
I would use the standard asset camera follow/orbit script for now, and worry about getting the hovercraft or whatever it is to drive correctly. All camera movement should be in your camera controller… it will make your life a lot simpler