- Home /
Rolling ball camera?
hi, im trying to make a rolling ball game, the ball moves with respect to the axis of the world (xyz) I want the ball moves forward when the camera rotates
this is the ball script
var fuerza = 10;
function Update () {
if (Input.GetKey("up"))
rigidbody.AddForce(Vector3(0, 0, fuerza));
if (Input.GetKey ("right"))
rigidbody.AddForce(Vector3(fuerza, 0, 0));
if (Input.GetKey ("down"))
rigidbody.AddForce(-Vector3(0, 0, fuerza));
if (Input.GetKey ("left"))
rigidbody.AddForce(-Vector3(fuerza, 0, 0));
}
Answer by BobbleHead · Aug 12, 2011 at 10:23 AM
I to have been playing with a rolling ball idea for some time, here's a vbery simple solution.
child an empty game objject to the ball, make sure its in the centre, then add this code:
function Update () {
transform.eulerAngles = Vector3(0, 0, 0);
}
to the camera, and make the camera the child to empty game object.
Should work untill you find a more complex solution
Your answer
Follow this Question
Related Questions
Mouse look turn with rolling ball 1 Answer
Super Monkey Ball type Camera? 2 Answers
How to make camera position relative to a specific target. 1 Answer
Stop ball rolling off wall but bouncing off 1 Answer
Ball Rolling Game Help 0 Answers