* Applying Danx0r's BasicPhysics update.

Sugilite
Adam Frisby 2007-06-29 18:37:26 +00:00
parent 6b3777d3db
commit cc1c4c034c
1 changed files with 23 additions and 16 deletions

View File

@ -101,22 +101,29 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
{ {
foreach (BasicActor actor in _actors) foreach (BasicActor actor in _actors)
{ {
if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256))
{
float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f;
actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep);
actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); if (actor.Flying)
/*if(actor.Flying)
{ {
actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); if (actor.Position.Z + (actor.Velocity.Z * timeStep) <
_heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2)
{
actor.Position.Z = height;
actor.Velocity.Z = 0;
} }
else else
{ {
actor.Position.Z = actor.Position.Z + ((-9.8f + actor.Velocity.Z) * timeStep); actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep);
} }
if(actor.Position.Z < (_heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1)) }
{*/ else
if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256))
{ {
actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1; actor.Position.Z = height;
actor.Velocity.Z = 0;
}
} }
else else
{ {
@ -211,7 +218,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
{ {
get get
{ {
return false; return flying;
} }
set set
{ {