Search Unity

How I let a ball rotate?

Discussion in 'Animation' started by JoelEbert, Nov 3, 2013.

  1. JoelEbert

    JoelEbert

    Joined:
    Nov 3, 2013
    Posts:
    31
    Hey guys, Im completely new to Unity3D I only have read a littlebit of the book Unity3D Game Developement by Example: Lite, but now i wanted to go ahead and try to make my own Project, I want to make Pong. So i already have my Player, the enemy, the ball, a long cube to make the ball bounce from side to side (I have deactivated mesh renderer so you can't see it), the light and 1 Script ( I already have the rigidbody for the ball). So this 1 script is there to make the ball rotate (just as an animation not something for the gameplay), it looks like this:
    "function Update () {
    transform.rotation.x += 0.2;
    transform.rotation.z += 0.2;
    }"

    I wrote it into the function update so it updates this everytime but it looks like it does just 1 time, what I made wrong?
    It would be nice when u explain me to how to givethe ball like a "kick" to the left or right from the middle so it can bounce from 1 paddle to the other :). And please explain me the code then too. I know, maybe this is a little bit much, and my grammar and general english skills are not the best (Im german) but a answer would be nice. :)
     
    Last edited: Nov 3, 2013
unityunity