diff options
author | UbitUmarov | 2012-02-18 16:16:48 +0000 |
---|---|---|
committer | UbitUmarov | 2012-02-18 16:16:48 +0000 |
commit | 91a326331fedc702cc3f04a628841447b90d009a (patch) | |
tree | 744959a5db548e0505183a71df2c3a5b5fe89f12 | |
parent | let SOG know about vehicles. Still needs serialization and applyphyscis on d... (diff) | |
download | opensim-SC_OLD-91a326331fedc702cc3f04a628841447b90d009a.zip opensim-SC_OLD-91a326331fedc702cc3f04a628841447b90d009a.tar.gz opensim-SC_OLD-91a326331fedc702cc3f04a628841447b90d009a.tar.bz2 opensim-SC_OLD-91a326331fedc702cc3f04a628841447b90d009a.tar.xz |
vehicle parameters do cross (i hope) on regions in same instance ( others need xml)
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SOGVehicle.cs | 63 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 7 |
2 files changed, 57 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SOGVehicle.cs b/OpenSim/Region/Framework/Scenes/SOGVehicle.cs index d6e9a3a..b7c93e5 100644 --- a/OpenSim/Region/Framework/Scenes/SOGVehicle.cs +++ b/OpenSim/Region/Framework/Scenes/SOGVehicle.cs | |||
@@ -39,13 +39,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
39 | { | 39 | { |
40 | get { return m_type; } | 40 | get { return m_type; } |
41 | } | 41 | } |
42 | private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier | ||
43 | private Quaternion m_RollreferenceFrame = Quaternion.Identity; // what hell is this ? | ||
44 | 42 | ||
45 | private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind | 43 | private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind |
46 | |||
47 | private VehicleFlag m_flags = (VehicleFlag)0; | 44 | private VehicleFlag m_flags = (VehicleFlag)0; |
48 | private Vector3 m_BlockingEndPoint = Vector3.Zero; // not sl | ||
49 | 45 | ||
50 | // Linear properties | 46 | // Linear properties |
51 | private Vector3 m_linearMotorDirection = Vector3.Zero; // velocity requested by LSL, decayed by time | 47 | private Vector3 m_linearMotorDirection = Vector3.Zero; // velocity requested by LSL, decayed by time |
@@ -81,6 +77,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
81 | private float m_verticalAttractionEfficiency = 1.0f; // damped | 77 | private float m_verticalAttractionEfficiency = 1.0f; // damped |
82 | private float m_verticalAttractionTimescale = 1000f; // Timescale > 300 means no vert attractor. | 78 | private float m_verticalAttractionTimescale = 1000f; // Timescale > 300 means no vert attractor. |
83 | 79 | ||
80 | // Axis | ||
81 | public Quaternion m_referenceFrame = Quaternion.Identity; | ||
82 | |||
84 | public void ProcessFloatVehicleParam(Vehicle pParam, float pValue) | 83 | public void ProcessFloatVehicleParam(Vehicle pParam, float pValue) |
85 | { | 84 | { |
86 | float len; | 85 | float len; |
@@ -235,9 +234,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
235 | if (len > 100.0f) | 234 | if (len > 100.0f) |
236 | m_linearMotorOffset *= (100.0f / len); | 235 | m_linearMotorOffset *= (100.0f / len); |
237 | break; | 236 | break; |
238 | case Vehicle.BLOCK_EXIT: | ||
239 | m_BlockingEndPoint = new Vector3(pValue.X, pValue.Y, pValue.Z); | ||
240 | break; | ||
241 | } | 237 | } |
242 | }//end ProcessVectorVehicleParam | 238 | }//end ProcessVectorVehicleParam |
243 | 239 | ||
@@ -248,9 +244,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
248 | case Vehicle.REFERENCE_FRAME: | 244 | case Vehicle.REFERENCE_FRAME: |
249 | m_referenceFrame = Quaternion.Inverse(pValue); | 245 | m_referenceFrame = Quaternion.Inverse(pValue); |
250 | break; | 246 | break; |
251 | case Vehicle.ROLL_FRAME: | ||
252 | m_RollreferenceFrame = pValue; | ||
253 | break; | ||
254 | } | 247 | } |
255 | }//end ProcessRotationVehicleParam | 248 | }//end ProcessRotationVehicleParam |
256 | 249 | ||
@@ -271,8 +264,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
271 | m_linearMotorDirection = Vector3.Zero; | 264 | m_linearMotorDirection = Vector3.Zero; |
272 | m_angularMotorDirection = Vector3.Zero; | 265 | m_angularMotorDirection = Vector3.Zero; |
273 | 266 | ||
274 | m_BlockingEndPoint = Vector3.Zero; | ||
275 | m_RollreferenceFrame = Quaternion.Identity; | ||
276 | m_linearMotorOffset = Vector3.Zero; | 267 | m_linearMotorOffset = Vector3.Zero; |
277 | 268 | ||
278 | m_referenceFrame = Quaternion.Identity; | 269 | m_referenceFrame = Quaternion.Identity; |
@@ -427,5 +418,53 @@ namespace OpenSim.Region.Framework.Scenes | |||
427 | break; | 418 | break; |
428 | } | 419 | } |
429 | } | 420 | } |
421 | public void SetVehicle(PhysicsActor ph) | ||
422 | { | ||
423 | |||
424 | // crap crap crap | ||
425 | if (ph == null) // what ?? | ||
426 | return; | ||
427 | |||
428 | ph.VehicleType = (int)m_type; | ||
429 | |||
430 | // Linear properties | ||
431 | ph.VehicleVectorParam((int)Vehicle.LINEAR_MOTOR_DIRECTION, m_linearMotorDirection); | ||
432 | ph.VehicleVectorParam((int)Vehicle.LINEAR_FRICTION_TIMESCALE, m_linearFrictionTimescale); | ||
433 | ph.VehicleFloatParam((int)Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE, m_linearMotorDecayTimescale); | ||
434 | ph.VehicleFloatParam((int)Vehicle.LINEAR_MOTOR_TIMESCALE, m_linearMotorTimescale); | ||
435 | ph.VehicleVectorParam((int)Vehicle.LINEAR_MOTOR_OFFSET, m_linearMotorOffset); | ||
436 | |||
437 | //Angular properties | ||
438 | ph.VehicleVectorParam((int)Vehicle.ANGULAR_MOTOR_DIRECTION, m_angularMotorDirection); | ||
439 | ph.VehicleFloatParam((int)Vehicle.ANGULAR_MOTOR_TIMESCALE, m_angularMotorTimescale); | ||
440 | ph.VehicleFloatParam((int)Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE, m_angularMotorDecayTimescale); | ||
441 | ph.VehicleVectorParam((int)Vehicle.ANGULAR_FRICTION_TIMESCALE, m_angularFrictionTimescale); | ||
442 | |||
443 | //Deflection properties | ||
444 | ph.VehicleFloatParam((int)Vehicle.ANGULAR_DEFLECTION_EFFICIENCY, m_angularDeflectionEfficiency); | ||
445 | ph.VehicleFloatParam((int)Vehicle.ANGULAR_DEFLECTION_TIMESCALE, m_angularDeflectionTimescale); | ||
446 | ph.VehicleFloatParam((int)Vehicle.LINEAR_DEFLECTION_EFFICIENCY, m_linearDeflectionEfficiency); | ||
447 | ph.VehicleFloatParam((int)Vehicle.LINEAR_DEFLECTION_TIMESCALE, m_linearDeflectionTimescale); | ||
448 | |||
449 | //Banking properties | ||
450 | ph.VehicleFloatParam((int)Vehicle.BANKING_EFFICIENCY, m_bankingEfficiency); | ||
451 | ph.VehicleFloatParam((int)Vehicle.BANKING_MIX, m_bankingMix); | ||
452 | ph.VehicleFloatParam((int)Vehicle.BANKING_TIMESCALE, m_bankingTimescale); | ||
453 | |||
454 | //Hover and Buoyancy properties | ||
455 | ph.VehicleFloatParam((int)Vehicle.HOVER_HEIGHT, m_VhoverHeight); | ||
456 | ph.VehicleFloatParam((int)Vehicle.HOVER_EFFICIENCY, m_VhoverEfficiency); | ||
457 | ph.VehicleFloatParam((int)Vehicle.HOVER_TIMESCALE, m_VhoverTimescale); | ||
458 | ph.VehicleFloatParam((int)Vehicle.BUOYANCY, m_VehicleBuoyancy); | ||
459 | |||
460 | //Attractor properties | ||
461 | ph.VehicleFloatParam((int)Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, m_verticalAttractionEfficiency); | ||
462 | ph.VehicleFloatParam((int)Vehicle.VERTICAL_ATTRACTION_TIMESCALE, m_verticalAttractionTimescale); | ||
463 | |||
464 | ph.VehicleRotationParam((int)Vehicle.REFERENCE_FRAME, m_referenceFrame); | ||
465 | |||
466 | ph.VehicleFlags(~(int)m_flags, true); | ||
467 | ph.VehicleFlags((int)m_flags, false); | ||
468 | } | ||
430 | } | 469 | } |
431 | } \ No newline at end of file | 470 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 1bac4d8..324fdb8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1782,14 +1782,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1782 | // ResetChildPrimPhysicsPositions(); | 1782 | // ResetChildPrimPhysicsPositions(); |
1783 | if (m_rootPart.PhysActor != null) | 1783 | if (m_rootPart.PhysActor != null) |
1784 | { | 1784 | { |
1785 | if (m_vehicle != null) | ||
1786 | m_vehicle.SetVehicle(m_rootPart.PhysActor); | ||
1785 | m_rootPart.PhysActor.Building = false; | 1787 | m_rootPart.PhysActor.Building = false; |
1786 | |||
1787 | } | 1788 | } |
1788 | } | 1789 | } |
1789 | else | 1790 | else |
1790 | { | 1791 | { |
1791 | // Apply physics to the root prim | 1792 | // Apply physics to the root prim |
1792 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false); | 1793 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false); |
1794 | if (m_rootPart.PhysActor != null && m_vehicle != null) | ||
1795 | { | ||
1796 | m_vehicle.SetVehicle(m_rootPart.PhysActor); | ||
1797 | } | ||
1793 | } | 1798 | } |
1794 | } | 1799 | } |
1795 | 1800 | ||