From 76569ff4fba09f22ed4a06b8073deaed7f64a2e3 Mon Sep 17 00:00:00 2001 From: MW Date: Sat, 10 Mar 2007 20:30:25 +0000 Subject: A PhysX physics plugin (that actually uses physX now but currently only works on windows) Can now change direction when walking without stopping Flying works when using the Physx dll --- src/physics/plugins/PhysXplugin.cs | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'src/physics/plugins') diff --git a/src/physics/plugins/PhysXplugin.cs b/src/physics/plugins/PhysXplugin.cs index 58a82fb..8c09dc8 100644 --- a/src/physics/plugins/PhysXplugin.cs +++ b/src/physics/plugins/PhysXplugin.cs @@ -85,14 +85,30 @@ namespace PhysXplugin return act; } + public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) + { + return null; + } + public override void Simulate(float timeStep) { foreach (PhysXActor actor in _actors) { - actor.Position.X = actor.Position.X + actor.Velocity.X * timeStep; - actor.Position.Y = actor.Position.Y + actor.Velocity.Y * timeStep; - actor.Position.Z = actor.Position.Z + actor.Velocity.Z * timeStep; - actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1; + actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); + actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); + actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); + /*if(actor.Flying) + { + actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); + } + else + { + actor.Position.Z = actor.Position.Z + ((-9.8f + actor.Velocity.Z) * timeStep); + } + if(actor.Position.Z < (_heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1)) + {*/ + actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1; + //} if(actor.Position.X<0) { actor.Position.X = 0; @@ -140,7 +156,7 @@ namespace PhysXplugin private PhysicsVector _position; private PhysicsVector _velocity; private PhysicsVector _acceleration; - + private bool flying; public PhysXActor() { _velocity = new PhysicsVector(); @@ -148,6 +164,18 @@ namespace PhysXplugin _acceleration = new PhysicsVector(); } + public override bool Flying + { + get + { + return false; + } + set + { + flying= value; + } + } + public override PhysicsVector Position { get -- cgit v1.1