diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 123 |
1 files changed, 68 insertions, 55 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 2da2331..cf33d0e 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -54,18 +54,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
54 | { | 54 | { |
55 | public class BSDynamics | 55 | public class BSDynamics |
56 | { | 56 | { |
57 | private int frcount = 0; // Used to limit dynamics debug output to | 57 | private BSScene PhysicsScene { get; set; } |
58 | // every 100th frame | 58 | // the prim this dynamic controller belongs to |
59 | 59 | private BSPrim Prim { get; set; } | |
60 | private BSScene m_physicsScene; | ||
61 | private BSPrim m_prim; // the prim this dynamic controller belongs to | ||
62 | 60 | ||
63 | // Vehicle properties | 61 | // Vehicle properties |
64 | private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind | 62 | public Vehicle Type { get; set; } |
65 | public Vehicle Type | 63 | |
66 | { | ||
67 | get { return m_type; } | ||
68 | } | ||
69 | // private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier | 64 | // private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier |
70 | private VehicleFlag m_flags = (VehicleFlag) 0; // Boolean settings: | 65 | private VehicleFlag m_flags = (VehicleFlag) 0; // Boolean settings: |
71 | // HOVER_TERRAIN_ONLY | 66 | // HOVER_TERRAIN_ONLY |
@@ -126,14 +121,20 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
126 | 121 | ||
127 | public BSDynamics(BSScene myScene, BSPrim myPrim) | 122 | public BSDynamics(BSScene myScene, BSPrim myPrim) |
128 | { | 123 | { |
129 | m_physicsScene = myScene; | 124 | PhysicsScene = myScene; |
130 | m_prim = myPrim; | 125 | Prim = myPrim; |
131 | m_type = Vehicle.TYPE_NONE; | 126 | Type = Vehicle.TYPE_NONE; |
127 | } | ||
128 | |||
129 | // Return 'true' if this vehicle is doing vehicle things | ||
130 | public bool IsActive | ||
131 | { | ||
132 | get { return Type != Vehicle.TYPE_NONE; } | ||
132 | } | 133 | } |
133 | 134 | ||
134 | internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue) | 135 | internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue) |
135 | { | 136 | { |
136 | VDetailLog("{0},ProcessFloatVehicleParam,param={1},val={2}", m_prim.LocalID, pParam, pValue); | 137 | VDetailLog("{0},ProcessFloatVehicleParam,param={1},val={2}", Prim.LocalID, pParam, pValue); |
137 | switch (pParam) | 138 | switch (pParam) |
138 | { | 139 | { |
139 | case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY: | 140 | case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY: |
@@ -232,7 +233,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
232 | 233 | ||
233 | internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue) | 234 | internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue) |
234 | { | 235 | { |
235 | VDetailLog("{0},ProcessVectorVehicleParam,param={1},val={2}", m_prim.LocalID, pParam, pValue); | 236 | VDetailLog("{0},ProcessVectorVehicleParam,param={1},val={2}", Prim.LocalID, pParam, pValue); |
236 | switch (pParam) | 237 | switch (pParam) |
237 | { | 238 | { |
238 | case Vehicle.ANGULAR_FRICTION_TIMESCALE: | 239 | case Vehicle.ANGULAR_FRICTION_TIMESCALE: |
@@ -267,7 +268,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
267 | 268 | ||
268 | internal void ProcessRotationVehicleParam(Vehicle pParam, Quaternion pValue) | 269 | internal void ProcessRotationVehicleParam(Vehicle pParam, Quaternion pValue) |
269 | { | 270 | { |
270 | VDetailLog("{0},ProcessRotationalVehicleParam,param={1},val={2}", m_prim.LocalID, pParam, pValue); | 271 | VDetailLog("{0},ProcessRotationalVehicleParam,param={1},val={2}", Prim.LocalID, pParam, pValue); |
271 | switch (pParam) | 272 | switch (pParam) |
272 | { | 273 | { |
273 | case Vehicle.REFERENCE_FRAME: | 274 | case Vehicle.REFERENCE_FRAME: |
@@ -281,7 +282,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
281 | 282 | ||
282 | internal void ProcessVehicleFlags(int pParam, bool remove) | 283 | internal void ProcessVehicleFlags(int pParam, bool remove) |
283 | { | 284 | { |
284 | VDetailLog("{0},ProcessVehicleFlags,param={1},remove={2}", m_prim.LocalID, pParam, remove); | 285 | VDetailLog("{0},ProcessVehicleFlags,param={1},remove={2}", Prim.LocalID, pParam, remove); |
285 | VehicleFlag parm = (VehicleFlag)pParam; | 286 | VehicleFlag parm = (VehicleFlag)pParam; |
286 | if (remove) | 287 | if (remove) |
287 | { | 288 | { |
@@ -301,9 +302,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
301 | 302 | ||
302 | internal void ProcessTypeChange(Vehicle pType) | 303 | internal void ProcessTypeChange(Vehicle pType) |
303 | { | 304 | { |
304 | VDetailLog("{0},ProcessTypeChange,type={1}", m_prim.LocalID, pType); | 305 | VDetailLog("{0},ProcessTypeChange,type={1}", Prim.LocalID, pType); |
305 | // Set Defaults For Type | 306 | // Set Defaults For Type |
306 | m_type = pType; | 307 | Type = pType; |
307 | switch (pType) | 308 | switch (pType) |
308 | { | 309 | { |
309 | case Vehicle.TYPE_NONE: | 310 | case Vehicle.TYPE_NONE: |
@@ -465,26 +466,37 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
465 | } | 466 | } |
466 | }//end SetDefaultsForType | 467 | }//end SetDefaultsForType |
467 | 468 | ||
469 | // Some of the properties of this prim may have changed. | ||
470 | // Do any updating needed for a vehicle | ||
471 | public void Refresh() | ||
472 | { | ||
473 | if (Type == Vehicle.TYPE_NONE) return; | ||
474 | |||
475 | // Set the prim's inertia to zero. The vehicle code handles that and this | ||
476 | // removes the torque action introduced by Bullet. | ||
477 | Vector3 inertia = Vector3.Zero; | ||
478 | BulletSimAPI.SetMassProps2(Prim.BSBody.ptr, Prim.MassRaw, inertia); | ||
479 | BulletSimAPI.UpdateInertiaTensor2(Prim.BSBody.ptr); | ||
480 | } | ||
481 | |||
468 | // One step of the vehicle properties for the next 'pTimestep' seconds. | 482 | // One step of the vehicle properties for the next 'pTimestep' seconds. |
469 | internal void Step(float pTimestep) | 483 | internal void Step(float pTimestep) |
470 | { | 484 | { |
471 | if (m_type == Vehicle.TYPE_NONE) return; | 485 | if (!IsActive) return; |
472 | |||
473 | frcount++; // used to limit debug comment output | ||
474 | if (frcount > 100) | ||
475 | frcount = 0; | ||
476 | 486 | ||
477 | MoveLinear(pTimestep); | 487 | MoveLinear(pTimestep); |
478 | MoveAngular(pTimestep); | 488 | MoveAngular(pTimestep); |
479 | LimitRotation(pTimestep); | 489 | LimitRotation(pTimestep); |
480 | 490 | ||
481 | // remember the position so next step we can limit absolute movement effects | 491 | // remember the position so next step we can limit absolute movement effects |
482 | m_lastPositionVector = m_prim.Position; | 492 | m_lastPositionVector = Prim.Position; |
483 | 493 | ||
484 | VDetailLog("{0},BSDynamics.Step,done,pos={1},force={2},velocity={3},angvel={4}", | 494 | VDetailLog("{0},BSDynamics.Step,done,pos={1},force={2},velocity={3},angvel={4}", |
485 | m_prim.LocalID, m_prim.Position, m_prim.Force, m_prim.Velocity, m_prim.RotationalVelocity); | 495 | Prim.LocalID, Prim.Position, Prim.Force, Prim.Velocity, Prim.RotationalVelocity); |
486 | }// end Step | 496 | }// end Step |
487 | 497 | ||
498 | // Apply the effect of the linear motor. | ||
499 | // Also does hover and float. | ||
488 | private void MoveLinear(float pTimestep) | 500 | private void MoveLinear(float pTimestep) |
489 | { | 501 | { |
490 | // m_linearMotorDirection is the direction we are moving relative to the vehicle coordinates | 502 | // m_linearMotorDirection is the direction we are moving relative to the vehicle coordinates |
@@ -520,18 +532,18 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
520 | m_linearMotorDirection *= keepfraction; | 532 | m_linearMotorDirection *= keepfraction; |
521 | 533 | ||
522 | VDetailLog("{0},MoveLinear,nonZero,origdir={1},origvel={2},add={3},notDecay={4},dir={5},vel={6}", | 534 | VDetailLog("{0},MoveLinear,nonZero,origdir={1},origvel={2},add={3},notDecay={4},dir={5},vel={6}", |
523 | m_prim.LocalID, origDir, origVel, addAmount, keepfraction, m_linearMotorDirection, m_lastLinearVelocityVector); | 535 | Prim.LocalID, origDir, origVel, addAmount, keepfraction, m_linearMotorDirection, m_lastLinearVelocityVector); |
524 | } | 536 | } |
525 | else | 537 | else |
526 | { | 538 | { |
527 | // if what remains of direction is very small, zero it. | 539 | // if what remains of direction is very small, zero it. |
528 | m_linearMotorDirection = Vector3.Zero; | 540 | m_linearMotorDirection = Vector3.Zero; |
529 | m_lastLinearVelocityVector = Vector3.Zero; | 541 | m_lastLinearVelocityVector = Vector3.Zero; |
530 | VDetailLog("{0},MoveLinear,zeroed", m_prim.LocalID); | 542 | VDetailLog("{0},MoveLinear,zeroed", Prim.LocalID); |
531 | } | 543 | } |
532 | 544 | ||
533 | // convert requested object velocity to object relative vector | 545 | // convert requested object velocity to object relative vector |
534 | Quaternion rotq = m_prim.Orientation; | 546 | Quaternion rotq = Prim.Orientation; |
535 | m_newVelocity = m_lastLinearVelocityVector * rotq; | 547 | m_newVelocity = m_lastLinearVelocityVector * rotq; |
536 | 548 | ||
537 | // Add the various forces into m_dir which will be our new direction vector (velocity) | 549 | // Add the various forces into m_dir which will be our new direction vector (velocity) |
@@ -539,7 +551,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
539 | // add Gravity and Buoyancy | 551 | // add Gravity and Buoyancy |
540 | // There is some gravity, make a gravity force vector that is applied after object velocity. | 552 | // There is some gravity, make a gravity force vector that is applied after object velocity. |
541 | // m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g; | 553 | // m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g; |
542 | Vector3 grav = m_prim.PhysicsScene.DefaultGravity * (m_prim.Mass * (1f - m_VehicleBuoyancy)); | 554 | Vector3 grav = Prim.PhysicsScene.DefaultGravity * (Prim.Mass * (1f - m_VehicleBuoyancy)); |
543 | 555 | ||
544 | /* | 556 | /* |
545 | * RA: Not sure why one would do this | 557 | * RA: Not sure why one would do this |
@@ -548,11 +560,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
548 | m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity | 560 | m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity |
549 | */ | 561 | */ |
550 | 562 | ||
551 | Vector3 pos = m_prim.Position; | 563 | Vector3 pos = Prim.Position; |
552 | // Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f); | 564 | // Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f); |
553 | 565 | ||
554 | // If below the terrain, move us above the ground a little. | 566 | // If below the terrain, move us above the ground a little. |
555 | float terrainHeight = m_prim.PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos); | 567 | float terrainHeight = Prim.PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos); |
556 | // Taking the rotated size doesn't work here because m_prim.Size is the size of the root prim and not the linkset. | 568 | // Taking the rotated size doesn't work here because m_prim.Size is the size of the root prim and not the linkset. |
557 | // Need to add a m_prim.LinkSet.Size similar to m_prim.LinkSet.Mass. | 569 | // Need to add a m_prim.LinkSet.Size similar to m_prim.LinkSet.Mass. |
558 | // Vector3 rotatedSize = m_prim.Size * m_prim.Orientation; | 570 | // Vector3 rotatedSize = m_prim.Size * m_prim.Orientation; |
@@ -560,8 +572,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
560 | if (pos.Z < terrainHeight) | 572 | if (pos.Z < terrainHeight) |
561 | { | 573 | { |
562 | pos.Z = terrainHeight + 2; | 574 | pos.Z = terrainHeight + 2; |
563 | m_prim.Position = pos; | 575 | Prim.Position = pos; |
564 | VDetailLog("{0},MoveLinear,terrainHeight,terrainHeight={1},pos={2}", m_prim.LocalID, terrainHeight, pos); | 576 | VDetailLog("{0},MoveLinear,terrainHeight,terrainHeight={1},pos={2}", Prim.LocalID, terrainHeight, pos); |
565 | } | 577 | } |
566 | 578 | ||
567 | // Check if hovering | 579 | // Check if hovering |
@@ -570,7 +582,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
570 | // We should hover, get the target height | 582 | // We should hover, get the target height |
571 | if ((m_flags & VehicleFlag.HOVER_WATER_ONLY) != 0) | 583 | if ((m_flags & VehicleFlag.HOVER_WATER_ONLY) != 0) |
572 | { | 584 | { |
573 | m_VhoverTargetHeight = m_prim.PhysicsScene.GetWaterLevelAtXYZ(pos) + m_VhoverHeight; | 585 | m_VhoverTargetHeight = Prim.PhysicsScene.GetWaterLevelAtXYZ(pos) + m_VhoverHeight; |
574 | } | 586 | } |
575 | if ((m_flags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0) | 587 | if ((m_flags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0) |
576 | { | 588 | { |
@@ -590,7 +602,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
590 | { | 602 | { |
591 | if ((pos.Z - m_VhoverTargetHeight) > .2 || (pos.Z - m_VhoverTargetHeight) < -.2) | 603 | if ((pos.Z - m_VhoverTargetHeight) > .2 || (pos.Z - m_VhoverTargetHeight) < -.2) |
592 | { | 604 | { |
593 | m_prim.Position = pos; | 605 | Prim.Position = pos; |
594 | } | 606 | } |
595 | } | 607 | } |
596 | else | 608 | else |
@@ -608,7 +620,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
608 | } | 620 | } |
609 | } | 621 | } |
610 | 622 | ||
611 | VDetailLog("{0},MoveLinear,hover,pos={1},dir={2},height={3},target={4}", m_prim.LocalID, pos, m_newVelocity, m_VhoverHeight, m_VhoverTargetHeight); | 623 | VDetailLog("{0},MoveLinear,hover,pos={1},dir={2},height={3},target={4}", Prim.LocalID, pos, m_newVelocity, m_VhoverHeight, m_VhoverTargetHeight); |
612 | } | 624 | } |
613 | 625 | ||
614 | Vector3 posChange = pos - m_lastPositionVector; | 626 | Vector3 posChange = pos - m_lastPositionVector; |
@@ -642,9 +654,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
642 | } | 654 | } |
643 | if (changed) | 655 | if (changed) |
644 | { | 656 | { |
645 | m_prim.Position = pos; | 657 | Prim.Position = pos; |
646 | VDetailLog("{0},MoveLinear,blockingEndPoint,block={1},origPos={2},pos={3}", | 658 | VDetailLog("{0},MoveLinear,blockingEndPoint,block={1},origPos={2},pos={3}", |
647 | m_prim.LocalID, m_BlockingEndPoint, posChange, pos); | 659 | Prim.LocalID, m_BlockingEndPoint, posChange, pos); |
648 | } | 660 | } |
649 | } | 661 | } |
650 | 662 | ||
@@ -664,7 +676,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
664 | float postemp = (pos.Z - terrainHeight); | 676 | float postemp = (pos.Z - terrainHeight); |
665 | if (postemp > 2.5f) | 677 | if (postemp > 2.5f) |
666 | grav.Z = (float)(grav.Z * 1.037125); | 678 | grav.Z = (float)(grav.Z * 1.037125); |
667 | VDetailLog("{0},MoveLinear,limitMotorUp,grav={1}", m_prim.LocalID, grav); | 679 | VDetailLog("{0},MoveLinear,limitMotorUp,grav={1}", Prim.LocalID, grav); |
668 | } | 680 | } |
669 | if ((m_flags & (VehicleFlag.NO_X)) != 0) | 681 | if ((m_flags & (VehicleFlag.NO_X)) != 0) |
670 | m_newVelocity.X = 0; | 682 | m_newVelocity.X = 0; |
@@ -674,7 +686,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
674 | m_newVelocity.Z = 0; | 686 | m_newVelocity.Z = 0; |
675 | 687 | ||
676 | // Apply velocity | 688 | // Apply velocity |
677 | m_prim.Velocity = m_newVelocity; | 689 | Prim.Velocity = m_newVelocity; |
678 | // apply gravity force | 690 | // apply gravity force |
679 | // Why is this set here? The physics engine already does gravity. | 691 | // Why is this set here? The physics engine already does gravity. |
680 | // m_prim.AddForce(grav, false); | 692 | // m_prim.AddForce(grav, false); |
@@ -684,10 +696,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
684 | m_lastLinearVelocityVector *= keepFraction; | 696 | m_lastLinearVelocityVector *= keepFraction; |
685 | 697 | ||
686 | VDetailLog("{0},MoveLinear,done,lmDir={1},lmVel={2},newVel={3},grav={4},1Mdecay={5}", | 698 | VDetailLog("{0},MoveLinear,done,lmDir={1},lmVel={2},newVel={3},grav={4},1Mdecay={5}", |
687 | m_prim.LocalID, m_linearMotorDirection, m_lastLinearVelocityVector, m_newVelocity, grav, keepFraction); | 699 | Prim.LocalID, m_linearMotorDirection, m_lastLinearVelocityVector, m_newVelocity, grav, keepFraction); |
688 | 700 | ||
689 | } // end MoveLinear() | 701 | } // end MoveLinear() |
690 | 702 | ||
703 | // Apply the effect of the angular motor. | ||
691 | private void MoveAngular(float pTimestep) | 704 | private void MoveAngular(float pTimestep) |
692 | { | 705 | { |
693 | // m_angularMotorDirection // angular velocity requested by LSL motor | 706 | // m_angularMotorDirection // angular velocity requested by LSL motor |
@@ -699,7 +712,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
699 | // m_lastAngularVelocity // what was last applied to body | 712 | // m_lastAngularVelocity // what was last applied to body |
700 | 713 | ||
701 | // Get what the body is doing, this includes 'external' influences | 714 | // Get what the body is doing, this includes 'external' influences |
702 | Vector3 angularVelocity = m_prim.RotationalVelocity; | 715 | Vector3 angularVelocity = Prim.RotationalVelocity; |
703 | 716 | ||
704 | if (m_angularMotorApply > 0) | 717 | if (m_angularMotorApply > 0) |
705 | { | 718 | { |
@@ -716,7 +729,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
716 | m_angularMotorVelocity.Z += (m_angularMotorDirection.Z - m_angularMotorVelocity.Z) / (m_angularMotorTimescale / pTimestep); | 729 | m_angularMotorVelocity.Z += (m_angularMotorDirection.Z - m_angularMotorVelocity.Z) / (m_angularMotorTimescale / pTimestep); |
717 | 730 | ||
718 | VDetailLog("{0},MoveAngular,angularMotorApply,apply={1},angTScale={2},timeStep={3},origvel={4},dir={5},vel={6}", | 731 | VDetailLog("{0},MoveAngular,angularMotorApply,apply={1},angTScale={2},timeStep={3},origvel={4},dir={5},vel={6}", |
719 | m_prim.LocalID, m_angularMotorApply, m_angularMotorTimescale, pTimestep, origAngularVelocity, m_angularMotorDirection, m_angularMotorVelocity); | 732 | Prim.LocalID, m_angularMotorApply, m_angularMotorTimescale, pTimestep, origAngularVelocity, m_angularMotorDirection, m_angularMotorVelocity); |
720 | 733 | ||
721 | // This is done so that if script request rate is less than phys frame rate the expected | 734 | // This is done so that if script request rate is less than phys frame rate the expected |
722 | // velocity may still be acheived. | 735 | // velocity may still be acheived. |
@@ -737,7 +750,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
737 | { | 750 | { |
738 | float VAservo = 0.2f / (m_verticalAttractionTimescale / pTimestep); | 751 | float VAservo = 0.2f / (m_verticalAttractionTimescale / pTimestep); |
739 | // get present body rotation | 752 | // get present body rotation |
740 | Quaternion rotq = m_prim.Orientation; | 753 | Quaternion rotq = Prim.Orientation; |
741 | // make a vector pointing up | 754 | // make a vector pointing up |
742 | Vector3 verterr = Vector3.Zero; | 755 | Vector3 verterr = Vector3.Zero; |
743 | verterr.Z = 1.0f; | 756 | verterr.Z = 1.0f; |
@@ -767,7 +780,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
767 | vertattr.Y += bounce * angularVelocity.Y; | 780 | vertattr.Y += bounce * angularVelocity.Y; |
768 | 781 | ||
769 | VDetailLog("{0},MoveAngular,verticalAttraction,verterr={1},bounce={2},vertattr={3}", | 782 | VDetailLog("{0},MoveAngular,verticalAttraction,verterr={1},bounce={2},vertattr={3}", |
770 | m_prim.LocalID, verterr, bounce, vertattr); | 783 | Prim.LocalID, verterr, bounce, vertattr); |
771 | 784 | ||
772 | } // else vertical attractor is off | 785 | } // else vertical attractor is off |
773 | 786 | ||
@@ -784,13 +797,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
784 | { | 797 | { |
785 | m_lastAngularVelocity.X = 0; | 798 | m_lastAngularVelocity.X = 0; |
786 | m_lastAngularVelocity.Y = 0; | 799 | m_lastAngularVelocity.Y = 0; |
787 | VDetailLog("{0},MoveAngular,noDeflectionUp,lastAngular={1}", m_prim.LocalID, m_lastAngularVelocity); | 800 | VDetailLog("{0},MoveAngular,noDeflectionUp,lastAngular={1}", Prim.LocalID, m_lastAngularVelocity); |
788 | } | 801 | } |
789 | 802 | ||
790 | if (m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f)) | 803 | if (m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f)) |
791 | { | 804 | { |
792 | m_lastAngularVelocity = Vector3.Zero; // Reduce small value to zero. | 805 | m_lastAngularVelocity = Vector3.Zero; // Reduce small value to zero. |
793 | VDetailLog("{0},MoveAngular,zeroSmallValues,lastAngular={1}", m_prim.LocalID, m_lastAngularVelocity); | 806 | VDetailLog("{0},MoveAngular,zeroSmallValues,lastAngular={1}", Prim.LocalID, m_lastAngularVelocity); |
794 | } | 807 | } |
795 | 808 | ||
796 | // apply friction | 809 | // apply friction |
@@ -798,14 +811,14 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
798 | m_lastAngularVelocity -= m_lastAngularVelocity * decayamount; | 811 | m_lastAngularVelocity -= m_lastAngularVelocity * decayamount; |
799 | 812 | ||
800 | // Apply to the body | 813 | // Apply to the body |
801 | m_prim.RotationalVelocity = m_lastAngularVelocity; | 814 | Prim.RotationalVelocity = m_lastAngularVelocity; |
802 | 815 | ||
803 | VDetailLog("{0},MoveAngular,done,decay={1},lastAngular={2}", m_prim.LocalID, decayamount, m_lastAngularVelocity); | 816 | VDetailLog("{0},MoveAngular,done,decay={1},lastAngular={2}", Prim.LocalID, decayamount, m_lastAngularVelocity); |
804 | } //end MoveAngular | 817 | } //end MoveAngular |
805 | 818 | ||
806 | internal void LimitRotation(float timestep) | 819 | internal void LimitRotation(float timestep) |
807 | { | 820 | { |
808 | Quaternion rotq = m_prim.Orientation; | 821 | Quaternion rotq = Prim.Orientation; |
809 | Quaternion m_rot = rotq; | 822 | Quaternion m_rot = rotq; |
810 | bool changed = false; | 823 | bool changed = false; |
811 | if (m_RollreferenceFrame != Quaternion.Identity) | 824 | if (m_RollreferenceFrame != Quaternion.Identity) |
@@ -840,8 +853,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
840 | } | 853 | } |
841 | if (changed) | 854 | if (changed) |
842 | { | 855 | { |
843 | m_prim.Orientation = m_rot; | 856 | Prim.Orientation = m_rot; |
844 | VDetailLog("{0},LimitRotation,done,orig={1},new={2}", m_prim.LocalID, rotq, m_rot); | 857 | VDetailLog("{0},LimitRotation,done,orig={1},new={2}", Prim.LocalID, rotq, m_rot); |
845 | } | 858 | } |
846 | 859 | ||
847 | } | 860 | } |
@@ -849,8 +862,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
849 | // Invoke the detailed logger and output something if it's enabled. | 862 | // Invoke the detailed logger and output something if it's enabled. |
850 | private void VDetailLog(string msg, params Object[] args) | 863 | private void VDetailLog(string msg, params Object[] args) |
851 | { | 864 | { |
852 | if (m_prim.PhysicsScene.VehicleLoggingEnabled) | 865 | if (Prim.PhysicsScene.VehicleLoggingEnabled) |
853 | m_prim.PhysicsScene.PhysicsLogging.Write(msg, args); | 866 | Prim.PhysicsScene.PhysicsLogging.Write(msg, args); |
854 | } | 867 | } |
855 | } | 868 | } |
856 | } | 869 | } |