2D Bouncing Ball

518 Views Asked by At

Hello I am following a tutorial for a air hockey game and how do i make it so when the ball comes in contact with the barrier it bounces no matter how hard i hit it it bounces off. Since i am currently using bouncing 2d physics i need to apply force for it to bounce but i want it to bounce no matter the force. thank you for your help. i would appreciate a simple explanation since im new to unity. enter image description here

1

There are 1 best solutions below

2
rustyBucketBay On

You can set a constant Rigid body.Velocity in the reflected direction with Vector3. Reflect.

Constan velocity set is my proposal according to the explanation " it bounces no matter how hard i hit it it bounces off ". For a more detailed behavior, details can be handled in the code to set the velocity accordingly. A more detailed explanation would be needed but with the real behavior of the disk in mind, I would reflect the rigidbody's direction on hit event and if the velocity vector module is smaller than some threshold, set a constant speed.