refactor: StepRigidbody Method Improved
This commit is contained in:
parent
64205353e5
commit
697e7c35b9
|
@ -37,8 +37,6 @@ public class PhysicsEngine2D : IPhysicsEngine2D
|
|||
rigidBodies.Remove(rigidBody);
|
||||
}
|
||||
|
||||
private List<Line> lines = new List<Line>(32);
|
||||
|
||||
public void Step(float deltaTime)
|
||||
{
|
||||
float intervalDeltaTime = deltaTime / IterationCount;
|
||||
|
@ -53,12 +51,10 @@ public class PhysicsEngine2D : IPhysicsEngine2D
|
|||
}
|
||||
}
|
||||
|
||||
private void StepRigidBody(IRigidBody2D rigidBody, float intervalDeltaTime)
|
||||
private static void StepRigidBody(IRigidBody2D rigidBody, float intervalDeltaTime)
|
||||
{
|
||||
Vector2D nextPosition = rigidBody.Transform.Position;
|
||||
nextPosition += rigidBody.Velocity * intervalDeltaTime;
|
||||
|
||||
rigidBody.Transform.Position = nextPosition;
|
||||
rigidBody.Transform.Position += rigidBody.Velocity * intervalDeltaTime;
|
||||
rigidBody.Transform.Rotation += rigidBody.AngularVelocity * intervalDeltaTime;
|
||||
}
|
||||
|
||||
private void OnBehaviourAdded(IBehaviourController controller, IBehaviour behaviour)
|
||||
|
|
Loading…
Reference in New Issue