Hi!
Im a noob with Unity and over all in making games.
Iv got years of experince in programing. ( php, mysql etc.)
I want to make a simple game, like pong!
Iv got the layout of the game, iv got the paddels, iv got the ball. - But here is where it get tricky.
Iv tryid with rigidbodys, boxcolliders and other stuff, but i cant seem to get the paddels to stay inside the arena with out tilting or flying of the screen…!
Here’s the script for movement of the paddel.
var speed = 50.0;
function Update () {
var translation = Input.GetAxis ("Mouse Y") * speed;
translation *= Time.deltaTime;
transform.Translate (0, 0, translation);
}
A working example is found here, to se the effects of the script.
http://www.fuldskrue.dk/pong/pong.html
How do i get the paddel to stay inside the arena?
When trying to fix the transform.position.z = 0, the thing crashes trough the barriers if i put enough force on it.
Is it posible to make it move only inside a given area? fx. z= -5 to 5 ?
I hope somebody can help
//Dennis