I know there are a million other questions like this here, so sorry for being an idiot. Here goes:
My character is a RigidBody ball, and I have this:
( "a < b" would mean that a is the parent of b)
Ball < GameObject < Camera
Ball has a simple movement script attached.
GameObject has a script to stop it from rotating when Ball does.
Camera has a camera movement script.
Everything works right, except that the movement of Ball is not camera relative. Pushing forward always results in movement in one direction, regardless of which way the camera points.
The complicating factor is that I can't simply make the y rotation of Ball equal to that of the Camera, because that would effect the physics (if you hit a wall while spinning the camera you would bounce off differently).
So how do I make movement of my character relative to camera direction without rotating my character on the y axis when the camera turns?
My movement script:
That should give you a world-vector for your local camera Z-Axis vector times ten.
answered Dec 19 '10 at 05:58 PM
also you can go..
both give transform relative vectors
answered Aug 19 '11 at 03:13 AM