diff options
author | Teravus Ovares | 2008-01-18 02:26:43 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-01-18 02:26:43 +0000 |
commit | ecd6c1110a8249aec10d70d63dccccae470cf5b3 (patch) | |
tree | 0bb35a0a71c4467c79ef570bc4af8ac8e606480d /OpenSim | |
parent | parametrize like clauses for avatar picker (diff) | |
download | opensim-SC_OLD-ecd6c1110a8249aec10d70d63dccccae470cf5b3.zip opensim-SC_OLD-ecd6c1110a8249aec10d70d63dccccae470cf5b3.tar.gz opensim-SC_OLD-ecd6c1110a8249aec10d70d63dccccae470cf5b3.tar.bz2 opensim-SC_OLD-ecd6c1110a8249aec10d70d63dccccae470cf5b3.tar.xz |
* ODE Physics update. fixed weird rotation of the avatar surrogate.
* Set the avatar's radius to 0.37m, I think this gives the *best* balance between spaces the avatar can fit, and the ability to climb steps
* Fixed a few things
* Tweaked some more
* Played with gravity (-9.8m/s)
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 57 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 12 |
3 files changed, 44 insertions, 27 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 959e6ee..0a1977a 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -1510,7 +1510,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1510 | adb.AgentID = agentID; | 1510 | adb.AgentID = agentID; |
1511 | adb.SessionID = sessionID; // More security | 1511 | adb.SessionID = sessionID; // More security |
1512 | 1512 | ||
1513 | gdb.GodLevel = (byte) 100; | 1513 | gdb.GodLevel = (byte) 250; |
1514 | gdb.Token = token; | 1514 | gdb.Token = token; |
1515 | //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock; | 1515 | //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock; |
1516 | respondPacket.GrantData = gdb; | 1516 | respondPacket.GrantData = gdb; |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index bfdb90f..85aac93 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -71,8 +71,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
71 | private static float PID_D = 3020.0f; | 71 | private static float PID_D = 3020.0f; |
72 | private static float PID_P = 7000.0f; | 72 | private static float PID_P = 7000.0f; |
73 | private static float POSTURE_SERVO = 10000.0f; | 73 | private static float POSTURE_SERVO = 10000.0f; |
74 | public static float CAPSULE_RADIUS = 0.5f; | 74 | public static float CAPSULE_RADIUS = 0.37f; |
75 | public float CAPSULE_LENGTH = 0.79f; | 75 | public float CAPSULE_LENGTH = 2.140599f; |
76 | private bool flying = false; | 76 | private bool flying = false; |
77 | private bool m_iscolliding = false; | 77 | private bool m_iscolliding = false; |
78 | private bool m_iscollidingGround = false; | 78 | private bool m_iscollidingGround = false; |
@@ -326,12 +326,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
326 | lock (OdeScene.OdeLock) | 326 | lock (OdeScene.OdeLock) |
327 | { | 327 | { |
328 | d.JointDestroy(Amotor); | 328 | d.JointDestroy(Amotor); |
329 | |||
329 | PhysicsVector SetSize = value; | 330 | PhysicsVector SetSize = value; |
330 | float prevCapsule = CAPSULE_LENGTH; | 331 | float prevCapsule = CAPSULE_LENGTH; |
331 | float capsuleradius = CAPSULE_RADIUS; | 332 | float capsuleradius = CAPSULE_RADIUS; |
332 | capsuleradius = 0.2f; | 333 | //capsuleradius = 0.2f; |
333 | 334 | ||
334 | CAPSULE_LENGTH = (SetSize.Z - ((SetSize.Z*0.43f))); // subtract 43% of the size | 335 | CAPSULE_LENGTH = (SetSize.Z - ((SetSize.Z*0.43f))); // subtract 43% of the size |
336 | OpenSim.Framework.Console.MainLog.Instance.Verbose("SIZE", CAPSULE_LENGTH.ToString()); | ||
335 | d.BodyDestroy(Body); | 337 | d.BodyDestroy(Body); |
336 | d.GeomDestroy(Shell); | 338 | d.GeomDestroy(Shell); |
337 | AvatarGeomAndBodyCreation(_position.X, _position.Y, | 339 | AvatarGeomAndBodyCreation(_position.X, _position.Y, |
@@ -351,6 +353,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
351 | /// <param name="npositionZ"></param> | 353 | /// <param name="npositionZ"></param> |
352 | private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ) | 354 | private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ) |
353 | { | 355 | { |
356 | |||
354 | int dAMotorEuler = 1; | 357 | int dAMotorEuler = 1; |
355 | Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); | 358 | Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); |
356 | d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH); | 359 | d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH); |
@@ -360,7 +363,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
360 | d.BodySetMass(Body, ref ShellMass); | 363 | d.BodySetMass(Body, ref ShellMass); |
361 | 364 | ||
362 | // 90 Stand up on the cap of the capped cyllinder | 365 | // 90 Stand up on the cap of the capped cyllinder |
363 | d.RFromAxisAndAngle(out m_StandUpRotation, 1, 0, 0, (float)(Math.PI / 2)); | 366 | d.RFromAxisAndAngle(out m_StandUpRotation, 1, 0, 1, (float)(Math.PI / 2)); |
364 | 367 | ||
365 | 368 | ||
366 | d.GeomSetRotation(Shell, ref m_StandUpRotation); | 369 | d.GeomSetRotation(Shell, ref m_StandUpRotation); |
@@ -395,21 +398,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
395 | d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f); | 398 | d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f); |
396 | d.JointSetAMotorParam(Amotor, (int)dParam.FMax, 3800000f); | 399 | d.JointSetAMotorParam(Amotor, (int)dParam.FMax, 3800000f); |
397 | 400 | ||
398 | 401 | //standupStraight(); | |
399 | // The purpose of this routine here is to quickly stabilize the Body while it's popped up in the air. | 402 | |
400 | // The amotor needs a few seconds to stabilize so without it, the avatar shoots up sky high when you | ||
401 | // change appearance and when you enter the simulator | ||
402 | // After this routine is done, the amotor stabilizes much quicker | ||
403 | d.Vector3 feet; | ||
404 | d.Vector3 head; | ||
405 | d.BodyGetRelPointPos(Body, 0.0f, 0.0f, -1.0f, out feet); | ||
406 | d.BodyGetRelPointPos(Body, 0.0f, 0.0f, 1.0f, out head); | ||
407 | float posture = head.Z - feet.Z; | ||
408 | |||
409 | // restoring force proportional to lack of posture: | ||
410 | float servo = (2.5f - posture) * POSTURE_SERVO; | ||
411 | d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); | ||
412 | d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); | ||
413 | 403 | ||
414 | 404 | ||
415 | } | 405 | } |
@@ -428,6 +418,27 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
428 | } | 418 | } |
429 | } | 419 | } |
430 | 420 | ||
421 | private void standupStraight() | ||
422 | { | ||
423 | |||
424 | // The purpose of this routine here is to quickly stabilize the Body while it's popped up in the air. | ||
425 | // The amotor needs a few seconds to stabilize so without it, the avatar shoots up sky high when you | ||
426 | // change appearance and when you enter the simulator | ||
427 | // After this routine is done, the amotor stabilizes much quicker | ||
428 | d.Vector3 feet; | ||
429 | d.Vector3 head; | ||
430 | d.BodyGetRelPointPos(Body, 0.0f, 0.0f, -1.0f, out feet); | ||
431 | d.BodyGetRelPointPos(Body, 0.0f, 0.0f, 1.0f, out head); | ||
432 | float posture = head.Z - feet.Z; | ||
433 | |||
434 | // restoring force proportional to lack of posture: | ||
435 | float servo = (2.5f - posture) * POSTURE_SERVO; | ||
436 | d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); | ||
437 | d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); | ||
438 | d.Matrix3 bodyrotation = d.BodyGetRotation(Body); | ||
439 | OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICSAV", "Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); | ||
440 | } | ||
441 | |||
431 | public override PhysicsVector Force | 442 | public override PhysicsVector Force |
432 | { | 443 | { |
433 | get { return new PhysicsVector(_target_velocity.X, _target_velocity.Y, _target_velocity.Z); } | 444 | get { return new PhysicsVector(_target_velocity.X, _target_velocity.Y, _target_velocity.Z); } |
@@ -467,7 +478,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
467 | public override Quaternion Orientation | 478 | public override Quaternion Orientation |
468 | { | 479 | { |
469 | get { return Quaternion.Identity; } | 480 | get { return Quaternion.Identity; } |
470 | set { } | 481 | set { |
482 | //Matrix3 or = Orientation.ToRotationMatrix(); | ||
483 | //d.Matrix3 ord = new d.Matrix3(or.m00, or.m10, or.m20, or.m01, or.m11, or.m21, or.m02, or.m12, or.m22); | ||
484 | //d.BodySetRotation(Body, ref ord); | ||
485 | |||
486 | } | ||
471 | } | 487 | } |
472 | 488 | ||
473 | public override PhysicsVector Acceleration | 489 | public override PhysicsVector Acceleration |
@@ -505,6 +521,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
505 | if (!collidelock) | 521 | if (!collidelock) |
506 | { | 522 | { |
507 | d.BodyAddForce(Body, force.X, force.Y, force.Z); | 523 | d.BodyAddForce(Body, force.X, force.Y, force.Z); |
524 | //standupStraight(); | ||
508 | } | 525 | } |
509 | } | 526 | } |
510 | 527 | ||
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 47839ca..4045add 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -174,7 +174,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
174 | 174 | ||
175 | // Set the gravity,, don't disable things automatically (we set it explicitly on some things) | 175 | // Set the gravity,, don't disable things automatically (we set it explicitly on some things) |
176 | 176 | ||
177 | d.WorldSetGravity(world, 0.0f, 0.0f, -10.0f); | 177 | d.WorldSetGravity(world, 0.0f, 0.0f, -9.8f); |
178 | d.WorldSetAutoDisableFlag(world, false); | 178 | d.WorldSetAutoDisableFlag(world, false); |
179 | d.WorldSetContactSurfaceLayer(world, 0.001f); | 179 | d.WorldSetContactSurfaceLayer(world, 0.001f); |
180 | 180 | ||
@@ -336,8 +336,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
336 | 336 | ||
337 | if (contacts[i].depth >= 0.08f) | 337 | if (contacts[i].depth >= 0.08f) |
338 | { | 338 | { |
339 | /* This is disabled at the moment only because it needs more tweaking | 339 | //This is disabled at the moment only because it needs more tweaking |
340 | It will eventually be uncommented | 340 | //It will eventually be uncommented |
341 | 341 | ||
342 | if (contacts[i].depth >= 1.00f) | 342 | if (contacts[i].depth >= 1.00f) |
343 | { | 343 | { |
@@ -363,7 +363,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
363 | else | 363 | else |
364 | { | 364 | { |
365 | 365 | ||
366 | contacts[i].depth = 0.0000000f; | 366 | //contacts[i].depth = 0.0000000f; |
367 | } | 367 | } |
368 | if (p1.PhysicsActorType == (int) ActorTypes.Agent) | 368 | if (p1.PhysicsActorType == (int) ActorTypes.Agent) |
369 | { | 369 | { |
@@ -378,10 +378,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
378 | else | 378 | else |
379 | { | 379 | { |
380 | 380 | ||
381 | contacts[i].depth = 0.0000000f; | 381 | //contacts[i].depth = 0.0000000f; |
382 | } | 382 | } |
383 | } | 383 | } |
384 | */ | 384 | |
385 | 385 | ||
386 | // If you interpenetrate a prim with another prim | 386 | // If you interpenetrate a prim with another prim |
387 | if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) | 387 | if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) |