private void OnCollisionDetected( RigidBody body1, RigidBody body2, JVector point1, JVector point2, JVector normal, float penetration) { var gameObjects = FindGameObjectsWithComponent <PhysicsComponent>(); GameObject retractor; if (body1.IsStatic) { retractor = gameObjects.First(gameObject => gameObject.GetComponent <PhysicsComponent>().RigidBody == body2); body2.LinearVelocity = JVector.Zero; } else { retractor = gameObjects.First(gameObject => gameObject.GetComponent <PhysicsComponent>().RigidBody == body1); body1.LinearVelocity = JVector.Zero; } //retractor.GetComponent<PhysicsComponent>().RigidBody.AddForce(normal*-penetration); //first.GetComponent<PhysicsComponent>().RigidBody.LinearVelocity = JVector.Zero; //retractor.GetComponent<PhysicsComponent>().RigidBody.Force = JVector.Zero; retractor.Transform.Position += Vector3.Normalize(normal.Cast()) * penetration; //Console.WriteLine($"Collision detected! {body2.Position} {body2.Force}"); }