diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 66 |
1 files changed, 59 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index bacc9c9..e026ffd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -140,6 +140,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
140 | private Vector3 m_lastPosition; | 140 | private Vector3 m_lastPosition; |
141 | private Quaternion m_lastRotation; | 141 | private Quaternion m_lastRotation; |
142 | private Vector3 m_lastVelocity; | 142 | private Vector3 m_lastVelocity; |
143 | private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); | ||
144 | |||
143 | 145 | ||
144 | private Vector3? m_forceToApply; | 146 | private Vector3? m_forceToApply; |
145 | private int m_userFlags; | 147 | private int m_userFlags; |
@@ -562,7 +564,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
562 | // Scene.RegionInfo.RegionName, Name, m_velocity); | 564 | // Scene.RegionInfo.RegionName, Name, m_velocity); |
563 | } | 565 | } |
564 | } | 566 | } |
567 | /* | ||
568 | public override Vector3 AngularVelocity | ||
569 | { | ||
570 | get | ||
571 | { | ||
572 | if (PhysicsActor != null) | ||
573 | { | ||
574 | m_rotationalvelocity = PhysicsActor.RotationalVelocity; | ||
575 | |||
576 | // m_log.DebugFormat( | ||
577 | // "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", | ||
578 | // m_velocity, Name, Scene.RegionInfo.RegionName); | ||
579 | } | ||
565 | 580 | ||
581 | return m_rotationalvelocity; | ||
582 | } | ||
583 | } | ||
584 | */ | ||
566 | private Quaternion m_bodyRot = Quaternion.Identity; | 585 | private Quaternion m_bodyRot = Quaternion.Identity; |
567 | 586 | ||
568 | public Quaternion Rotation | 587 | public Quaternion Rotation |
@@ -1260,6 +1279,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1260 | PhysicsActor.Size = new Vector3(0.45f, 0.6f, height); | 1279 | PhysicsActor.Size = new Vector3(0.45f, 0.6f, height); |
1261 | } | 1280 | } |
1262 | 1281 | ||
1282 | public void SetSize(Vector3 size, float feetoffset) | ||
1283 | { | ||
1284 | if (PhysicsActor != null && !IsChildAgent) | ||
1285 | PhysicsActor.setAvatarSize(size, feetoffset); | ||
1286 | |||
1287 | } | ||
1288 | |||
1263 | /// <summary> | 1289 | /// <summary> |
1264 | /// Complete Avatar's movement into the region. | 1290 | /// Complete Avatar's movement into the region. |
1265 | /// </summary> | 1291 | /// </summary> |
@@ -2566,9 +2592,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2566 | // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to | 2592 | // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to |
2567 | // grab the latest PhysicsActor velocity, whereas m_velocity is often | 2593 | // grab the latest PhysicsActor velocity, whereas m_velocity is often |
2568 | // storing a requested force instead of an actual traveling velocity | 2594 | // storing a requested force instead of an actual traveling velocity |
2595 | if (Appearance.AvatarSize != m_lastSize) | ||
2596 | { | ||
2597 | m_lastSize = Appearance.AvatarSize; | ||
2598 | SendAvatarDataToAllAgents(); | ||
2599 | } | ||
2569 | 2600 | ||
2570 | // Throw away duplicate or insignificant updates | 2601 | else if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || |
2571 | if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || | ||
2572 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || | 2602 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || |
2573 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) | 2603 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) |
2574 | { | 2604 | { |
@@ -2866,6 +2896,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2866 | 2896 | ||
2867 | avatar.ControllingClient.SendAppearance( | 2897 | avatar.ControllingClient.SendAppearance( |
2868 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); | 2898 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); |
2899 | |||
2900 | |||
2869 | } | 2901 | } |
2870 | 2902 | ||
2871 | #endregion | 2903 | #endregion |
@@ -3438,15 +3470,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3438 | } | 3470 | } |
3439 | 3471 | ||
3440 | if (Appearance.AvatarHeight == 0) | 3472 | if (Appearance.AvatarHeight == 0) |
3441 | Appearance.SetHeight(); | 3473 | // Appearance.SetHeight(); |
3474 | Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); | ||
3442 | 3475 | ||
3443 | PhysicsScene scene = m_scene.PhysicsScene; | 3476 | PhysicsScene scene = m_scene.PhysicsScene; |
3444 | 3477 | ||
3445 | Vector3 pVec = AbsolutePosition; | 3478 | Vector3 pVec = AbsolutePosition; |
3446 | 3479 | ||
3480 | /* | ||
3447 | PhysicsActor = scene.AddAvatar( | 3481 | PhysicsActor = scene.AddAvatar( |
3448 | LocalId, Firstname + "." + Lastname, pVec, | 3482 | LocalId, Firstname + "." + Lastname, pVec, |
3449 | new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying); | 3483 | new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying); |
3484 | */ | ||
3485 | |||
3486 | PhysicsActor = scene.AddAvatar( | ||
3487 | LocalId, Firstname + "." + Lastname, pVec, | ||
3488 | Appearance.AvatarBoxSize,Appearance.AvatarFeetOffset, isFlying); | ||
3450 | 3489 | ||
3451 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | 3490 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; |
3452 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 3491 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |
@@ -3465,6 +3504,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); | 3504 | ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); |
3466 | } | 3505 | } |
3467 | 3506 | ||
3507 | |||
3468 | /// <summary> | 3508 | /// <summary> |
3469 | /// Event called by the physics plugin to tell the avatar about a collision. | 3509 | /// Event called by the physics plugin to tell the avatar about a collision. |
3470 | /// </summary> | 3510 | /// </summary> |
@@ -3494,7 +3534,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3494 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; | 3534 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; |
3495 | Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; | 3535 | Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; |
3496 | 3536 | ||
3497 | CollisionPlane = Vector4.UnitW; | ||
3498 | 3537 | ||
3499 | // // No collisions at all means we may be flying. Update always | 3538 | // // No collisions at all means we may be flying. Update always |
3500 | // // to make falling work | 3539 | // // to make falling work |
@@ -3506,6 +3545,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3506 | 3545 | ||
3507 | if (coldata.Count != 0) | 3546 | if (coldata.Count != 0) |
3508 | { | 3547 | { |
3548 | /* | ||
3509 | switch (Animator.CurrentMovementAnimation) | 3549 | switch (Animator.CurrentMovementAnimation) |
3510 | { | 3550 | { |
3511 | case "STAND": | 3551 | case "STAND": |
@@ -3514,24 +3554,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3514 | case "CROUCH": | 3554 | case "CROUCH": |
3515 | case "CROUCHWALK": | 3555 | case "CROUCHWALK": |
3516 | { | 3556 | { |
3557 | */ | ||
3517 | ContactPoint lowest; | 3558 | ContactPoint lowest; |
3518 | lowest.SurfaceNormal = Vector3.Zero; | 3559 | lowest.SurfaceNormal = Vector3.Zero; |
3519 | lowest.Position = Vector3.Zero; | 3560 | lowest.Position = Vector3.Zero; |
3520 | lowest.Position.Z = Single.NaN; | 3561 | lowest.Position.Z = float.MaxValue; |
3521 | 3562 | ||
3522 | foreach (ContactPoint contact in coldata.Values) | 3563 | foreach (ContactPoint contact in coldata.Values) |
3523 | { | 3564 | { |
3524 | if (Single.IsNaN(lowest.Position.Z) || contact.Position.Z < lowest.Position.Z) | 3565 | |
3566 | if (contact.CharacterFeet && contact.Position.Z < lowest.Position.Z) | ||
3525 | { | 3567 | { |
3526 | lowest = contact; | 3568 | lowest = contact; |
3527 | } | 3569 | } |
3528 | } | 3570 | } |
3529 | 3571 | ||
3530 | CollisionPlane = new Vector4(-lowest.SurfaceNormal, -Vector3.Dot(lowest.Position, lowest.SurfaceNormal)); | 3572 | if (lowest.Position.Z != float.MaxValue) |
3573 | { | ||
3574 | lowest.SurfaceNormal = -lowest.SurfaceNormal; | ||
3575 | CollisionPlane = new Vector4(lowest.SurfaceNormal, Vector3.Dot(lowest.Position, lowest.SurfaceNormal)); | ||
3576 | } | ||
3577 | else | ||
3578 | CollisionPlane = Vector4.UnitW; | ||
3579 | /* | ||
3531 | } | 3580 | } |
3532 | break; | 3581 | break; |
3533 | } | 3582 | } |
3583 | */ | ||
3534 | } | 3584 | } |
3585 | else | ||
3586 | CollisionPlane = Vector4.UnitW; | ||
3535 | 3587 | ||
3536 | RaiseCollisionScriptEvents(coldata); | 3588 | RaiseCollisionScriptEvents(coldata); |
3537 | 3589 | ||