hi , i’m still young at unity and java and my first project is a pong like game (2d)
i got everything working except my ball is not rolling.
it is moving but when i added my ball texture i noticed it is not “rolling”
i use this to start moving my ball :
gameObject.rigidbody.AddForce(200,randomAngle,0);
Then to speed up the ball i use :
function OnCollisionEnter(theCollision : Collision)
{
if(theCollision.gameObject.name == "Player1")
{
gameObject.rigidbody.AddForce(rigidbody.velocity.normalized * 55);
audio.PlayOneShot(paddleSound1);
}
if(theCollision.gameObject.name == "Player2")
{
gameObject.rigidbody.AddForce(rigidbody.velocity.normalized * 55);
audio.PlayOneShot(paddleSound2);
}
there is no gravity and its 2d.
i think i have to get the x and y direction + the velocity to give it to the rotation
but i don’t know where to start atm, and maybe there is an easier way to do that.
thanks in advance for helping