aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs175
1 files changed, 52 insertions, 123 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 8a7c06a..c4aaebe 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -349,13 +349,7 @@ namespace OpenSim.Region.Framework.Scenes
349 /// </summary> 349 /// </summary>
350 protected Vector3 m_lastCameraPosition; 350 protected Vector3 m_lastCameraPosition;
351 351
352 protected Vector3 m_CameraPosition; 352 public Vector3 CameraPosition { get; set; }
353
354 public Vector3 CameraPosition
355 {
356 get { return m_CameraPosition; }
357 private set { m_CameraPosition = value; }
358 }
359 353
360 public Quaternion CameraRotation 354 public Quaternion CameraRotation
361 { 355 {
@@ -365,28 +359,9 @@ namespace OpenSim.Region.Framework.Scenes
365 // Use these three vectors to figure out what the agent is looking at 359 // Use these three vectors to figure out what the agent is looking at
366 // Convert it to a Matrix and/or Quaternion 360 // Convert it to a Matrix and/or Quaternion
367 // 361 //
368 protected Vector3 m_CameraAtAxis; 362 public Vector3 CameraAtAxis { get; set; }
369 protected Vector3 m_CameraLeftAxis; 363 public Vector3 CameraLeftAxis { get; set; }
370 protected Vector3 m_CameraUpAxis; 364 public Vector3 CameraUpAxis { get; set; }
371
372 public Vector3 CameraAtAxis
373 {
374 get { return m_CameraAtAxis; }
375 private set { m_CameraAtAxis = value; }
376 }
377
378
379 public Vector3 CameraLeftAxis
380 {
381 get { return m_CameraLeftAxis; }
382 private set { m_CameraLeftAxis = value; }
383 }
384
385 public Vector3 CameraUpAxis
386 {
387 get { return m_CameraUpAxis; }
388 private set { m_CameraUpAxis = value; }
389 }
390 365
391 public Vector3 Lookat 366 public Vector3 Lookat
392 { 367 {
@@ -402,33 +377,15 @@ namespace OpenSim.Region.Framework.Scenes
402 } 377 }
403 #endregion 378 #endregion
404 379
405 public readonly string Firstname; 380 public string Firstname { get; private set; }
406 public readonly string Lastname; 381 public string Lastname { get; private set; }
407 382
408 private string m_grouptitle; 383 public string Grouptitle { get; set; }
409
410 public string Grouptitle
411 {
412 get { return m_grouptitle; }
413 set { m_grouptitle = value; }
414 }
415 384
416 // Agent's Draw distance. 385 // Agent's Draw distance.
417 protected float m_DrawDistance; 386 public float DrawDistance { get; set; }
418 387
419 public float DrawDistance 388 public bool AllowMovement { get; set; }
420 {
421 get { return m_DrawDistance; }
422 private set { m_DrawDistance = value; }
423 }
424
425 protected bool m_allowMovement = true;
426
427 public bool AllowMovement
428 {
429 get { return m_allowMovement; }
430 set { m_allowMovement = value; }
431 }
432 389
433 private bool m_setAlwaysRun; 390 private bool m_setAlwaysRun;
434 391
@@ -455,13 +412,7 @@ namespace OpenSim.Region.Framework.Scenes
455 } 412 }
456 } 413 }
457 414
458 private byte m_state; 415 public byte State { get; set; }
459
460 public byte State
461 {
462 get { return m_state; }
463 set { m_state = value; }
464 }
465 416
466 private AgentManager.ControlFlags m_AgentControlFlags; 417 private AgentManager.ControlFlags m_AgentControlFlags;
467 418
@@ -471,29 +422,14 @@ namespace OpenSim.Region.Framework.Scenes
471 set { m_AgentControlFlags = (AgentManager.ControlFlags)value; } 422 set { m_AgentControlFlags = (AgentManager.ControlFlags)value; }
472 } 423 }
473 424
474 /// <summary> 425 public IClientAPI ControllingClient { get; set; }
475 /// This works out to be the ClientView object associated with this avatar, or it's client connection manager
476 /// </summary>
477 private IClientAPI m_controllingClient;
478
479 public IClientAPI ControllingClient
480 {
481 get { return m_controllingClient; }
482 private set { m_controllingClient = value; }
483 }
484 426
485 public IClientCore ClientView 427 public IClientCore ClientView
486 { 428 {
487 get { return (IClientCore) m_controllingClient; } 429 get { return (IClientCore)ControllingClient; }
488 } 430 }
489 431
490 protected Vector3 m_parentPosition; 432 public Vector3 ParentPosition { get; set; }
491
492 public Vector3 ParentPosition
493 {
494 get { return m_parentPosition; }
495 set { m_parentPosition = value; }
496 }
497 433
498 /// <summary> 434 /// <summary>
499 /// Position of this avatar relative to the region the avatar is in 435 /// Position of this avatar relative to the region the avatar is in
@@ -502,7 +438,7 @@ namespace OpenSim.Region.Framework.Scenes
502 { 438 {
503 get 439 get
504 { 440 {
505 if (PhysicsActor != null && m_parentID == 0) 441 if (PhysicsActor != null)
506 { 442 {
507 m_pos = PhysicsActor.Position; 443 m_pos = PhysicsActor.Position;
508 444
@@ -525,12 +461,12 @@ namespace OpenSim.Region.Framework.Scenes
525 // in the sim unless the avatar is on a sit target. While 461 // in the sim unless the avatar is on a sit target. While
526 // on a sit target, m_pos will contain the desired offset 462 // on a sit target, m_pos will contain the desired offset
527 // without the parent rotation applied. 463 // without the parent rotation applied.
528 if (ParentID != 0) 464 SceneObjectPart sitPart = ParentPart;
529 { 465
530 SceneObjectPart part = ParentPart; 466 if (sitPart != null)
531 return part.AbsolutePosition + (m_pos * part.GetWorldRotation()); 467 return sitPart.AbsolutePosition + (m_pos * sitPart.GetWorldRotation());
532 }
533 } 468 }
469
534 return m_pos; 470 return m_pos;
535 } 471 }
536 set 472 set
@@ -547,7 +483,7 @@ namespace OpenSim.Region.Framework.Scenes
547 } 483 }
548 } 484 }
549 485
550 // Don't update while sitting 486 // Don't update while sitting. The PhysicsActor above is null whilst sitting.
551 if (ParentID == 0) 487 if (ParentID == 0)
552 { 488 {
553 m_pos = value; 489 m_pos = value;
@@ -574,6 +510,7 @@ namespace OpenSim.Region.Framework.Scenes
574 // There is no offset position when not seated 510 // There is no offset position when not seated
575 if (ParentID == 0) 511 if (ParentID == 0)
576 return; 512 return;
513
577 m_pos = value; 514 m_pos = value;
578 } 515 }
579 } 516 }
@@ -632,12 +569,10 @@ namespace OpenSim.Region.Framework.Scenes
632 569
633 public bool IsChildAgent { get; set; } 570 public bool IsChildAgent { get; set; }
634 571
635 public uint ParentID 572 /// <summary>
636 { 573 /// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero.
637 get { return m_parentID; } 574 /// </summary>
638 set { m_parentID = value; } 575 public uint ParentID { get; set; }
639 }
640 private uint m_parentID;
641 576
642 public UUID ParentUUID 577 public UUID ParentUUID
643 { 578 {
@@ -646,12 +581,13 @@ namespace OpenSim.Region.Framework.Scenes
646 } 581 }
647 private UUID m_parentUUID = UUID.Zero; 582 private UUID m_parentUUID = UUID.Zero;
648 583
649 public SceneObjectPart ParentPart 584 /// <summary>
650 { 585 /// If the avatar is sitting, the prim that it's sitting on. If not sitting then null.
651 get { return m_parentPart; } 586 /// </summary>
652 set { m_parentPart = value; } 587 /// <remarks>
653 } 588 /// If you use this property then you must take a reference since another thread could set it to null.
654 private SceneObjectPart m_parentPart = null; 589 /// </remarks>
590 public SceneObjectPart ParentPart { get; set; }
655 591
656 public float Health 592 public float Health
657 { 593 {
@@ -760,7 +696,7 @@ namespace OpenSim.Region.Framework.Scenes
760 IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) 696 IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type)
761 { 697 {
762 AttachmentsSyncLock = new Object(); 698 AttachmentsSyncLock = new Object();
763 699 AllowMovement = true;
764 IsChildAgent = true; 700 IsChildAgent = true;
765 m_sendCourseLocationsMethod = SendCoarseLocationsDefault; 701 m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
766 Animator = new ScenePresenceAnimator(this); 702 Animator = new ScenePresenceAnimator(this);
@@ -839,17 +775,17 @@ namespace OpenSim.Region.Framework.Scenes
839 private Vector3[] GetWalkDirectionVectors() 775 private Vector3[] GetWalkDirectionVectors()
840 { 776 {
841 Vector3[] vector = new Vector3[11]; 777 Vector3[] vector = new Vector3[11];
842 vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD 778 vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD
843 vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK 779 vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK
844 vector[2] = Vector3.UnitY; //LEFT 780 vector[2] = Vector3.UnitY; //LEFT
845 vector[3] = -Vector3.UnitY; //RIGHT 781 vector[3] = -Vector3.UnitY; //RIGHT
846 vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP 782 vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP
847 vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN 783 vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN
848 vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE 784 vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE
849 vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE 785 vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE
850 vector[8] = Vector3.UnitY; //LEFT_NUDGE 786 vector[8] = Vector3.UnitY; //LEFT_NUDGE
851 vector[9] = -Vector3.UnitY; //RIGHT_NUDGE 787 vector[9] = -Vector3.UnitY; //RIGHT_NUDGE
852 vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE 788 vector[10] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE
853 return vector; 789 return vector;
854 } 790 }
855 791
@@ -1381,7 +1317,7 @@ namespace OpenSim.Region.Framework.Scenes
1381 // Convert it to a Matrix and/or Quaternion 1317 // Convert it to a Matrix and/or Quaternion
1382 CameraAtAxis = agentData.CameraAtAxis; 1318 CameraAtAxis = agentData.CameraAtAxis;
1383 CameraLeftAxis = agentData.CameraLeftAxis; 1319 CameraLeftAxis = agentData.CameraLeftAxis;
1384 m_CameraUpAxis = agentData.CameraUpAxis; 1320 CameraUpAxis = agentData.CameraUpAxis;
1385 1321
1386 // The Agent's Draw distance setting 1322 // The Agent's Draw distance setting
1387 // When we get to the point of re-computing neighbors everytime this 1323 // When we get to the point of re-computing neighbors everytime this
@@ -1393,7 +1329,7 @@ namespace OpenSim.Region.Framework.Scenes
1393 // Check if Client has camera in 'follow cam' or 'build' mode. 1329 // Check if Client has camera in 'follow cam' or 'build' mode.
1394 Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); 1330 Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation);
1395 1331
1396 m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) 1332 m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f)
1397 && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; 1333 && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false;
1398 1334
1399 m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; 1335 m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0;
@@ -2349,23 +2285,16 @@ namespace OpenSim.Region.Framework.Scenes
2349// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", 2285// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target",
2350// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); 2286// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId);
2351 } 2287 }
2352 }
2353 else
2354 {
2355 return;
2356 }
2357
2358 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2359 if (ParentPart == null)
2360 return;
2361 2288
2362 ParentID = m_requestedSitTargetID; 2289 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2290 ParentID = m_requestedSitTargetID;
2363 2291
2364 Velocity = Vector3.Zero; 2292 Velocity = Vector3.Zero;
2365 RemoveFromPhysicalScene(); 2293 RemoveFromPhysicalScene();
2366 2294
2367 Animator.TrySetMovementAnimation(sitAnimation); 2295 Animator.TrySetMovementAnimation(sitAnimation);
2368 SendAvatarDataToAllAgents(); 2296 SendAvatarDataToAllAgents();
2297 }
2369 } 2298 }
2370 2299
2371 public void HandleAgentSitOnGround() 2300 public void HandleAgentSitOnGround()
@@ -3161,7 +3090,7 @@ namespace OpenSim.Region.Framework.Scenes
3161 cAgent.Center = CameraPosition; 3090 cAgent.Center = CameraPosition;
3162 cAgent.AtAxis = CameraAtAxis; 3091 cAgent.AtAxis = CameraAtAxis;
3163 cAgent.LeftAxis = CameraLeftAxis; 3092 cAgent.LeftAxis = CameraLeftAxis;
3164 cAgent.UpAxis = m_CameraUpAxis; 3093 cAgent.UpAxis = CameraUpAxis;
3165 3094
3166 cAgent.Far = DrawDistance; 3095 cAgent.Far = DrawDistance;
3167 3096
@@ -3250,7 +3179,7 @@ namespace OpenSim.Region.Framework.Scenes
3250 CameraPosition = cAgent.Center; 3179 CameraPosition = cAgent.Center;
3251 CameraAtAxis = cAgent.AtAxis; 3180 CameraAtAxis = cAgent.AtAxis;
3252 CameraLeftAxis = cAgent.LeftAxis; 3181 CameraLeftAxis = cAgent.LeftAxis;
3253 m_CameraUpAxis = cAgent.UpAxis; 3182 CameraUpAxis = cAgent.UpAxis;
3254 ParentUUID = cAgent.ParentPart; 3183 ParentUUID = cAgent.ParentPart;
3255 m_prevSitOffset = cAgent.SitOffset; 3184 m_prevSitOffset = cAgent.SitOffset;
3256 3185