which script is better for block breaker games ?

hi everybody

i want to make a block breaker game like this :

which type of scripting is better for moving that ball ?

1 - use addforce ( i try this but it has many bugs !)
2 - use transform.position (i don’t think this can work !!!)
3 - you say !

thanks everybody

I would recommend using the rigidbody.velocity variable. Something like this:

var speed = 10.0;

function FixedUpdate () {
   var dir = rigidbody.velocity.normalized;
   rigidbody.velocity = dir * speed;
}

thanks it’s work nice .

but it only go forward and backward !!!

where is my problem ?

i attach this script into the sphere :

var speed = 10.0;
function Awake () {
rigidbody.velocity.y = -10;
}
function FixedUpdate () {
   var dir = rigidbody.velocity.normalized;
   print(dir);
   rigidbody.velocity = dir * speed;
}

how can i fix this bug ?

340149--11897--$block_810.jpg

Here’s a brick breaker project i made, i didnt think someone will make this type of game :]
Anyways, u can learn from the scripts, copy them, whatever, no license or anything, use it as u wish bro.
http://rs109.rapidshare.com/files/354034014/Brick-Breaker_Project_Files.rar
video of how it looks like:

*btw, sorry for the gibrish comments, delete them, they’re written in the Hebrew language… so u’ll need to use UTF 8 to see it in a language u don’t understand :wink:

very nice !

it’s very useful

you’re wonderful

You;re welcome :slight_smile:
have fun!