From d199767e6991d6f368661fce9c5a072e564b8a4b Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sun, 25 Oct 2009 23:16:12 -0700 Subject: Experimental change of PhysicsVector to Vector3. Untested --- .../BasicPhysicsPlugin/BasicPhysicsScene.cs | 40 +++++++++++++--------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs') diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs index 66bd099..b6e1cb4 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs @@ -54,7 +54,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin { } - public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) + public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) { BasicActor act = new BasicActor(); act.Position = position; @@ -77,20 +77,20 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin } /* - public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) + public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation) { return null; } */ - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, - PhysicsVector size, Quaternion rotation) + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + Vector3 size, Quaternion rotation) { return AddPrimShape(primName, pbs, position, size, rotation, false); } - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, - PhysicsVector size, Quaternion rotation, bool isPhysical) + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + Vector3 size, Quaternion rotation, bool isPhysical) { return null; } @@ -105,26 +105,28 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin for (int i = 0; i < _actors.Count; ++i) { BasicActor actor = _actors[i]; + Vector3 actorPosition = actor.Position; + Vector3 actorVelocity = actor.Velocity; - actor.Position.X += actor.Velocity.X*timeStep; - actor.Position.Y += actor.Velocity.Y*timeStep; + actorPosition.X += actor.Velocity.X*timeStep; + actorPosition.Y += actor.Velocity.Y*timeStep; if (actor.Position.Y < 0) { - actor.Position.Y = 0.1F; + actorPosition.Y = 0.1F; } else if (actor.Position.Y >= Constants.RegionSize) { - actor.Position.Y = ((int)Constants.RegionSize - 0.1f); + actorPosition.Y = ((int)Constants.RegionSize - 0.1f); } if (actor.Position.X < 0) { - actor.Position.X = 0.1F; + actorPosition.X = 0.1F; } else if (actor.Position.X >= Constants.RegionSize) { - actor.Position.X = ((int)Constants.RegionSize - 0.1f); + actorPosition.X = ((int)Constants.RegionSize - 0.1f); } float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z; @@ -133,23 +135,27 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin if (actor.Position.Z + (actor.Velocity.Z*timeStep) < _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2) { - actor.Position.Z = height; - actor.Velocity.Z = 0; + actorPosition.Z = height; + actorVelocity.Z = 0; actor.IsColliding = true; } else { - actor.Position.Z += actor.Velocity.Z*timeStep; + actorPosition.Z += actor.Velocity.Z*timeStep; actor.IsColliding = false; } } else { - actor.Position.Z = height; - actor.Velocity.Z = 0; + actorPosition.Z = height; + actorVelocity.Z = 0; actor.IsColliding = true; } + + actor.Position = actorPosition; + actor.Velocity = actorVelocity; } + return fps; } -- cgit v1.1