Fixed Simian diagonal movement and added limits for sim boundary
git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@2105 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -49,7 +49,7 @@ namespace Simian.Extensions
|
||||
|
||||
float speed = 0.5f;
|
||||
if ((heldForward || heldBack) && (heldLeft || heldRight))
|
||||
speed *= SQRT_TWO;
|
||||
speed /= SQRT_TWO;
|
||||
|
||||
if (heldForward)
|
||||
{
|
||||
@@ -79,6 +79,13 @@ namespace Simian.Extensions
|
||||
agent.Avatar.Velocity.X -= left.X * speed;
|
||||
agent.Avatar.Velocity.Y -= left.Y * speed;
|
||||
}
|
||||
|
||||
if (agent.Avatar.Position.X < 0) agent.Avatar.Position.X = 0f;
|
||||
else if (agent.Avatar.Position.X > 255) agent.Avatar.Position.X = 255f;
|
||||
|
||||
if (agent.Avatar.Position.Y < 0) agent.Avatar.Position.Y = 0f;
|
||||
else if (agent.Avatar.Position.Y > 255) agent.Avatar.Position.Y = 255f;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user