Arcanoid style game

First when game start. I can move around the game board, the X axis
The ball follows a game board When i press “space”

if(input.GetKeyDown("Space"))
{
    // ball bounce off 
}

if(transform.position.y <= -5) // the ball passes the game board
{
    //transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z);
    //transform.position = Vector3.Reflect(Player.transform.position, Vector3.up);
    
    // want ball to the paddle and stop again until press "space" 
}

So i little help Please! :slight_smile:

Avoid using transform.
Add a rigidbody to your ball so that it has a more natural feeling.
then use:

var velocity:Vector3;

function Start(){
    velocity = Vector3(0,0,0); // The ball is not moving.
}
function FixedUpdate () {
 rigidbody.MovePosition(rigidbody.position + velocity);
}
function Update(){
    if(input.GetKeyDown("Space")){
       velocity = Vector3(some values);  //The ball is moving
    }
}
function OnCollisionEnter(other : Collision){
 var norm : Vector3 = other.contacts[0].normal; 
    norm = norm.Normalize();   
    velocity.x = velocity.x - 2 * norm.x * Vector3.Dot(velocity,norm);
    velocity.z = velocity.z - 2 * norm.z * Vector3.Dot(velocity,norm);
} 

I cannot try but that should help you starting.

1.- I wish that the board is able to carry the ball.

1.1- when I press the button as the ball bounces off the board.

2.- yes… and then how to reposition the ball to the paddle again. :smiley:

Thank you all … Now I get up and running again. :wink:

what is wrong with this code

{

public GameObject Pelaaja; // player
// Painovoiman nopeuden rajat
public float TaysiVauhti = 20; // maxspeed
public float hidasVauhti = 15;// minspeed

// Elikkä aivan ensin tehdään tämä.
void Awake ()
{

//annetaan pallon fysiikalle vauhtia
rigidbody.velocity= new Vector3(0,-18,0);

}

void ballPosition() // ball get paddle position
{

rigidbody.transform.position = new Vector3( Pelaaja.transform.position.x,Pelaaja.transform.position.y,Pelaaja.transform.position.z);

}

void bounceBall()
{
//

if(Input.GetKeyDown(“space”))
{
print(“fire”);

// bounce ball
// aiheuttaa pallon putoamisen ____________________________________
float KokoVauhti = Vector3.Magnitude(rigidbody.velocity);

if(KokoVauhti>TaysiVauhti) // jos pallon putoaa liian kovaa
{
float Liiankovaa = KokoVauhti / TaysiVauhti;
rigidbody.velocity /= Liiankovaa;
}

else if (KokoVauhti