AddForce relative to camera rotation

Hi Unity,

I’m not a complete newb, but I’m really stumped by this one.
I have a game that uses a 3rd person controller and smooth follow camera script. The net effect, it that I have a world my character plays in that is full 3d, but the camera stays in sync with the character on his X & Y axis(NON ORBITING). In addition to this, I have a 2nd player on the screen who acts as a rover (rolling ball) who operates independently from the main character. My 2nd player is typically controlled by the right analog joystick of a PS3 or XBOX Controller. The control is driven by calling rigidbody.AddForce() on the ball itself. My problem arises when my levels do not have strict X & Y level design applied to them. It seems that rigidbody.AddForce() is relative to world coordinates and not current input direction.

Ideally, I would like to call AddRelativeForce based off of the the current camera rotation, but I’m really struggling with how to do that.

Anyone else ever have a situation like this?

Thanks,

John

You didn’t post any code, and I agree with robertbu that it is difficult to tell exactly what you mean, but I think I may understand you, and it seems pretty simple. Use Camera.main.transform.left or its inverse instead of Vector3.left.