aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-13 03:18:54 +0000
committerTeravus Ovares2007-11-13 03:18:54 +0000
commit57b646b7ae020453fbfcb3fe9ae27c4f5ce536ab (patch)
tree88dd0a93fc58a1d3c703dbb72ab36865186f3221 /OpenSim
parentadded IDs for all built-in animations (diff)
downloadopensim-SC_OLD-57b646b7ae020453fbfcb3fe9ae27c4f5ce536ab.zip
opensim-SC_OLD-57b646b7ae020453fbfcb3fe9ae27c4f5ce536ab.tar.gz
opensim-SC_OLD-57b646b7ae020453fbfcb3fe9ae27c4f5ce536ab.tar.bz2
opensim-SC_OLD-57b646b7ae020453fbfcb3fe9ae27c4f5ce536ab.tar.xz
* Added AV Height Glue & Avatar Height stored on m_AVHeight in ScenePresence
* Added glue to send it to the Physics Engines (in meters) * ODE Initial implementation of Avatar Height :D Change your height and not get all knee bendy
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs18
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs65
2 files changed, 59 insertions, 24 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 4502fb3..69bf05a 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -67,6 +67,7 @@ namespace OpenSim.Region.Environment.Scenes
67 private bool m_newForce = false; 67 private bool m_newForce = false;
68 private bool m_newAvatar = false; 68 private bool m_newAvatar = false;
69 private bool m_newCoarseLocations = true; 69 private bool m_newCoarseLocations = true;
70 private float m_avHeight = 127.0f;
70 71
71 protected RegionInfo m_regionInfo; 72 protected RegionInfo m_regionInfo;
72 protected ulong crossingFromRegion = 0; 73 protected ulong crossingFromRegion = 0;
@@ -442,12 +443,25 @@ namespace OpenSim.Region.Environment.Scenes
442 { 443 {
443 LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length); 444 LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length);
444 m_textureEntry = textureEnt; 445 m_textureEntry = textureEnt;
445 446
446 for (int i = 0; i < visualParam.Length; i++) 447 for (int i = 0; i < visualParam.Length; i++)
447 { 448 {
448 m_visualParams[i] = visualParam[i].ParamValue; 449 m_visualParams[i] = visualParam[i].ParamValue;
450 //OpenSim.Framework.Console.MainLog.Instance.Verbose("CLIENT", "VisualData[" + i.ToString() + "]: " + visualParam[i].ParamValue.ToString() + "m");
451
449 } 452 }
450 453
454 // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters.
455 // (float)m_visualParams[25] = Height
456 // (float)m_visualParams[125] = LegLength
457 m_avHeight = (1.50856f + (((float)m_visualParams[25] / 255.0f) * (2.525506f - 1.50856f)))
458 + (((float)m_visualParams[125] / 255.0f) / 1.5f);
459 if (PhysicsActor != null)
460 {
461 PhysicsVector SetSize = new PhysicsVector(0, 0, m_avHeight);
462 PhysicsActor.Size = SetSize;
463 }
464 //OpenSim.Framework.Console.MainLog.Instance.Verbose("CLIENT", "Set Avatar Height to: " + (1.50856f + (((float)m_visualParams[25] / 255.0f) * (2.525506f - 1.50856f))).ToString() + "m" + " Leglength: " + ((float)m_visualParams[125]).ToString() + ":" + (((float)m_visualParams[125] / 255.0f)).ToString() + "m");
451 SendAppearanceToAllOtherAgents(); 465 SendAppearanceToAllOtherAgents();
452 } 466 }
453 467
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index b528b9b..a397467 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -539,28 +539,28 @@ namespace OpenSim.Region.Physics.OdePlugin
539 /// debugging code 539 /// debugging code
540 float Zoff = -33.0f; 540 float Zoff = -33.0f;
541 d.Matrix3 temp = d.BodyGetRotation(actor.Body); 541 d.Matrix3 temp = d.BodyGetRotation(actor.Body);
542 Console.WriteLine("RENDER: cylinder; " + // shape 542 //Console.WriteLine("RENDER: cylinder; " + // shape
543 OdeCharacter.CAPSULE_RADIUS + ", " + OdeCharacter.CAPSULE_LENGTH + //size 543 //OdeCharacter.CAPSULE_RADIUS + ", " + OdeCharacter.CAPSULE_LENGTH + //size
544 "; 0, 1, 0; " + // color 544 //"; 0, 1, 0; " + // color
545 (actor.Position.X - 128.0f) + ", " + (actor.Position.Y - 128.0f) + ", " + 545 //(actor.Position.X - 128.0f) + ", " + (actor.Position.Y - 128.0f) + ", " +
546 (actor.Position.Z + Zoff) + "; " + // position 546 //(actor.Position.Z + Zoff) + "; " + // position
547 temp.M00 + "," + temp.M10 + "," + temp.M20 + ", " + // rotation 547 //temp.M00 + "," + temp.M10 + "," + temp.M20 + ", " + // rotation
548 temp.M01 + "," + temp.M11 + "," + temp.M21 + ", " + 548 //temp.M01 + "," + temp.M11 + "," + temp.M21 + ", " +
549 temp.M02 + "," + temp.M12 + "," + temp.M22); 549 //temp.M02 + "," + temp.M12 + "," + temp.M22);
550 d.Vector3 caphead; 550 d.Vector3 caphead;
551 d.BodyGetRelPointPos(actor.Body, 0, 0, OdeCharacter.CAPSULE_LENGTH*.5f, out caphead); 551 //d.BodyGetRelPointPos(actor.Body, 0, 0, OdeCharacter.CAPSULE_LENGTH*.5f, out caphead);
552 d.Vector3 capfoot; 552 d.Vector3 capfoot;
553 d.BodyGetRelPointPos(actor.Body, 0, 0, -OdeCharacter.CAPSULE_LENGTH*.5f, out capfoot); 553 //d.BodyGetRelPointPos(actor.Body, 0, 0, -OdeCharacter.CAPSULE_LENGTH*.5f, out capfoot);
554 Console.WriteLine("RENDER: sphere; " + OdeCharacter.CAPSULE_RADIUS + // shape, size 554 //Console.WriteLine("RENDER: sphere; " + OdeCharacter.CAPSULE_RADIUS + // shape, size
555 "; 1, 0, 1; " + //color 555 //"; 1, 0, 1; " + //color
556 (caphead.X - 128.0f) + ", " + (caphead.Y - 128.0f) + ", " + (caphead.Z + Zoff) + 556 //(caphead.X - 128.0f) + ", " + (caphead.Y - 128.0f) + ", " + (caphead.Z + Zoff) +
557 "; " + // position 557 //"; " + // position
558 "1,0,0, 0,1,0, 0,0,1"); // rotation 558 ///"1,0,0, 0,1,0, 0,0,1"); // rotation
559 Console.WriteLine("RENDER: sphere; " + OdeCharacter.CAPSULE_RADIUS + // shape, size 559 // Console.WriteLine("RENDER: sphere; " + OdeCharacter.CAPSULE_RADIUS + // shape, size
560 "; 1, 0, 0; " + //color 560 //"; 1, 0, 0; " + //color
561 (capfoot.X - 128.0f) + ", " + (capfoot.Y - 128.0f) + ", " + (capfoot.Z + Zoff) + 561 //(capfoot.X - 128.0f) + ", " + (capfoot.Y - 128.0f) + ", " + (capfoot.Z + Zoff) +
562 "; " + // position 562 //"; " + // position
563 "1,0,0, 0,1,0, 0,0,1"); // rotation 563 //"1,0,0, 0,1,0, 0,0,1"); // rotation
564 } 564 }
565 } 565 }
566 if (timeStep < 0.2f) 566 if (timeStep < 0.2f)
@@ -656,11 +656,12 @@ namespace OpenSim.Region.Physics.OdePlugin
656 private static float PID_P = 7000.0f; 656 private static float PID_P = 7000.0f;
657 private static float POSTURE_SERVO = 10000.0f; 657 private static float POSTURE_SERVO = 10000.0f;
658 public static float CAPSULE_RADIUS = 0.5f; 658 public static float CAPSULE_RADIUS = 0.5f;
659 public static float CAPSULE_LENGTH = 0.79f; 659 public float CAPSULE_LENGTH = 0.79f;
660 private bool flying = false; 660 private bool flying = false;
661 private bool m_iscolliding = false; 661 private bool m_iscolliding = false;
662 private bool m_wascolliding = false; 662 private bool m_wascolliding = false;
663 private bool m_alwaysRun = false; 663 private bool m_alwaysRun = false;
664 private string m_name = "";
664 665
665 private bool[] m_colliderarr = new bool[11]; 666 private bool[] m_colliderarr = new bool[11];
666 667
@@ -695,6 +696,7 @@ namespace OpenSim.Region.Physics.OdePlugin
695 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z); 696 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
696 d.GeomSetBody(Shell, Body); 697 d.GeomSetBody(Shell, Body);
697 } 698 }
699 m_name = avName;
698 parent_scene.geom_name_map[Shell] = avName; 700 parent_scene.geom_name_map[Shell] = avName;
699 parent_scene.actor_name_map[Shell] = (PhysicsActor)this; 701 parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
700 } 702 }
@@ -802,7 +804,26 @@ namespace OpenSim.Region.Physics.OdePlugin
802 public override PhysicsVector Size 804 public override PhysicsVector Size
803 { 805 {
804 get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); } 806 get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); }
805 set { } 807 set {
808 lock (OdeScene.OdeLock)
809 {
810 PhysicsVector SetSize = value;
811 float prevCapsule = CAPSULE_LENGTH;
812
813 CAPSULE_LENGTH = (SetSize.Z - (CAPSULE_RADIUS * 2))/ 1.75f; //;
814 d.BodyDestroy(Body);
815 d.GeomDestroy(Shell);
816 //OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Set Avatar Height To: " + (CAPSULE_RADIUS + CAPSULE_LENGTH));
817 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
818 d.MassSetCapsule(out ShellMass, 50.0f, 3, CAPSULE_RADIUS, CAPSULE_LENGTH);
819 Body = d.BodyCreate(_parent_scene.world);
820 d.BodySetMass(Body, ref ShellMass);
821 d.BodySetPosition(Body, _position.X, _position.Y, _position.Z + Math.Abs(CAPSULE_LENGTH-prevCapsule));
822 d.GeomSetBody(Shell, Body);
823 }
824 _parent_scene.geom_name_map[Shell] = m_name;
825 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
826 }
806 } 827 }
807 828
808 public override PrimitiveBaseShape Shape 829 public override PrimitiveBaseShape Shape