четверг, 7 июня 2012 г.

Perfect Arcanoid/Pong ball physics in Unity

this is what i did:
set Drag and Angular Drag of your ball to 0.

created bouncy physics material (u have similar in unity asets):
Dynamic Friction :0
Static Friction: 0
Bounciness: 1
Friction Combine: Minimum
Bounce Combine: Maximum
-- and everything else to 0!

Than on Project settings -> Physics set Bounce Threshold to 0.
If u don't do that and your ball movement speed is slow it will stay stuck in walls.

now just set velocity in desired direction and ball will bounce perfectly from all colliders. No need for calling update method to handle your physics.

Src: http://forum.unity3d.com/threads/97805-Arkanoid-in-Unity-Ball-Movement?p=945888#post945888
Bonus for 2d game: http://www.youtube.com/watch?v=qQ32rGOSg7E&feature=relmfu

Комментариев нет:

Отправить комментарий