diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index bacc9c9..9ada5bb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1260,6 +1260,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1260 | PhysicsActor.Size = new Vector3(0.45f, 0.6f, height); | 1260 | PhysicsActor.Size = new Vector3(0.45f, 0.6f, height); |
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | public void SetSize(Vector3 size, float feetoffset) | ||
1264 | { | ||
1265 | if (PhysicsActor != null && !IsChildAgent) | ||
1266 | PhysicsActor.setAvatarSize(size, feetoffset); | ||
1267 | } | ||
1268 | |||
1263 | /// <summary> | 1269 | /// <summary> |
1264 | /// Complete Avatar's movement into the region. | 1270 | /// Complete Avatar's movement into the region. |
1265 | /// </summary> | 1271 | /// </summary> |
@@ -3438,15 +3444,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3438 | } | 3444 | } |
3439 | 3445 | ||
3440 | if (Appearance.AvatarHeight == 0) | 3446 | if (Appearance.AvatarHeight == 0) |
3441 | Appearance.SetHeight(); | 3447 | // Appearance.SetHeight(); |
3448 | Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); | ||
3442 | 3449 | ||
3443 | PhysicsScene scene = m_scene.PhysicsScene; | 3450 | PhysicsScene scene = m_scene.PhysicsScene; |
3444 | 3451 | ||
3445 | Vector3 pVec = AbsolutePosition; | 3452 | Vector3 pVec = AbsolutePosition; |
3446 | 3453 | ||
3454 | /* | ||
3447 | PhysicsActor = scene.AddAvatar( | 3455 | PhysicsActor = scene.AddAvatar( |
3448 | LocalId, Firstname + "." + Lastname, pVec, | 3456 | LocalId, Firstname + "." + Lastname, pVec, |
3449 | new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying); | 3457 | new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying); |
3458 | */ | ||
3459 | |||
3460 | PhysicsActor = scene.AddAvatar( | ||
3461 | LocalId, Firstname + "." + Lastname, pVec, | ||
3462 | Appearance.AvatarBoxSize,Appearance.AvatarFeetOffset, isFlying); | ||
3450 | 3463 | ||
3451 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | 3464 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; |
3452 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 3465 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |
@@ -3465,6 +3478,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3465 | ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); | 3478 | ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); |
3466 | } | 3479 | } |
3467 | 3480 | ||
3481 | |||
3468 | /// <summary> | 3482 | /// <summary> |
3469 | /// Event called by the physics plugin to tell the avatar about a collision. | 3483 | /// Event called by the physics plugin to tell the avatar about a collision. |
3470 | /// </summary> | 3484 | /// </summary> |
@@ -3494,7 +3508,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3494 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; | 3508 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; |
3495 | Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; | 3509 | Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; |
3496 | 3510 | ||
3497 | CollisionPlane = Vector4.UnitW; | ||
3498 | 3511 | ||
3499 | // // No collisions at all means we may be flying. Update always | 3512 | // // No collisions at all means we may be flying. Update always |
3500 | // // to make falling work | 3513 | // // to make falling work |
@@ -3504,6 +3517,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3504 | // m_lastColCount = coldata.Count; | 3517 | // m_lastColCount = coldata.Count; |
3505 | // } | 3518 | // } |
3506 | 3519 | ||
3520 | CollisionPlane = Vector4.UnitW; | ||
3521 | |||
3507 | if (coldata.Count != 0) | 3522 | if (coldata.Count != 0) |
3508 | { | 3523 | { |
3509 | switch (Animator.CurrentMovementAnimation) | 3524 | switch (Animator.CurrentMovementAnimation) |
@@ -3517,17 +3532,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3517 | ContactPoint lowest; | 3532 | ContactPoint lowest; |
3518 | lowest.SurfaceNormal = Vector3.Zero; | 3533 | lowest.SurfaceNormal = Vector3.Zero; |
3519 | lowest.Position = Vector3.Zero; | 3534 | lowest.Position = Vector3.Zero; |
3520 | lowest.Position.Z = Single.NaN; | 3535 | lowest.Position.Z = float.MaxValue; |
3521 | 3536 | ||
3522 | foreach (ContactPoint contact in coldata.Values) | 3537 | foreach (ContactPoint contact in coldata.Values) |
3523 | { | 3538 | { |
3524 | if (Single.IsNaN(lowest.Position.Z) || contact.Position.Z < lowest.Position.Z) | 3539 | |
3540 | if (contact.CharacterFeet && contact.Position.Z < lowest.Position.Z) | ||
3525 | { | 3541 | { |
3526 | lowest = contact; | 3542 | lowest = contact; |
3527 | } | 3543 | } |
3528 | } | 3544 | } |
3529 | 3545 | ||
3530 | CollisionPlane = new Vector4(-lowest.SurfaceNormal, -Vector3.Dot(lowest.Position, lowest.SurfaceNormal)); | 3546 | if (lowest.Position.Z != float.MaxValue) |
3547 | { | ||
3548 | lowest.SurfaceNormal = -lowest.SurfaceNormal; | ||
3549 | CollisionPlane = new Vector4(lowest.SurfaceNormal, Vector3.Dot(lowest.Position, lowest.SurfaceNormal)); | ||
3550 | } | ||
3531 | } | 3551 | } |
3532 | break; | 3552 | break; |
3533 | } | 3553 | } |