feat: Ball Bounce Depending on Side Distance
This commit is contained in:
parent
ad60412d5f
commit
4e95a3a420
2
Engine
2
Engine
|
@ -1 +1 @@
|
|||
Subproject commit 1c7d941bc177d5c3fe24b428c1b89d5c2025642f
|
||||
Subproject commit d7d53e467a9fe118c8ec9e93ee97a3bd64b1208e
|
|
@ -44,6 +44,10 @@ public class MovementBallBehaviour : BehaviourOverride
|
|||
|
||||
private void OnCollisionDetected(ICollider2D collider2D, CollisionDetectionInformation information)
|
||||
{
|
||||
rigidBody.Velocity = rigidBody.Velocity.Reflect(information.Normal);
|
||||
// if (information.Left.BehaviourController.GameObject == GameObject)
|
||||
if (Syntriax.Engine.Core.Math.Abs(information.Normal.Dot(Vector2D.Right)) > .25)
|
||||
rigidBody.Velocity = information.Left.Transform.Position.FromTo(information.Right.Transform.Position).Normalized * rigidBody.Velocity.Magnitude;
|
||||
else
|
||||
rigidBody.Velocity = rigidBody.Velocity.Reflect(information.Normal);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue