diff options
author | Robert Adams | 2015-10-02 18:35:02 -0700 |
---|---|---|
committer | Robert Adams | 2015-10-02 18:35:02 -0700 |
commit | e1ce04de428f856d92ac21912364320ebbda7b1a (patch) | |
tree | d0807de24a2f0267aa18a791b01eb2a6263247b1 /OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs | |
parent | reduce some diferences with master (diff) | |
download | opensim-SC_OLD-e1ce04de428f856d92ac21912364320ebbda7b1a.zip opensim-SC_OLD-e1ce04de428f856d92ac21912364320ebbda7b1a.tar.gz opensim-SC_OLD-e1ce04de428f856d92ac21912364320ebbda7b1a.tar.bz2 opensim-SC_OLD-e1ce04de428f856d92ac21912364320ebbda7b1a.tar.xz |
Implement an overridable implementation of PhysicsActor.SetVehicle()
that works for all physics engines.
BulletSim: implement an optimized version of SetVehicle() that still
uses the vehicle code to do bounds checking but does it in one taint
operation.
Diffstat (limited to 'OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs index 1965dc2..a5c2c0e 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs | |||
@@ -162,8 +162,6 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
162 | /// </summary> | 162 | /// </summary> |
163 | public event CollisionUpdate OnCollisionUpdate; | 163 | public event CollisionUpdate OnCollisionUpdate; |
164 | 164 | ||
165 | public virtual void SetVehicle(object vdata) { } | ||
166 | |||
167 | public event OutOfBounds OnOutOfBounds; | 165 | public event OutOfBounds OnOutOfBounds; |
168 | #pragma warning restore 67 | 166 | #pragma warning restore 67 |
169 | 167 | ||
@@ -295,6 +293,56 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
295 | public abstract void VehicleRotationParam(int param, Quaternion rotation); | 293 | public abstract void VehicleRotationParam(int param, Quaternion rotation); |
296 | public abstract void VehicleFlags(int param, bool remove); | 294 | public abstract void VehicleFlags(int param, bool remove); |
297 | 295 | ||
296 | // This is an overridable version of SetVehicle() that works for all physics engines. | ||
297 | // This is VERY inefficient. It behoves any physics engine to override this and | ||
298 | // implement a more efficient setting of all the vehicle parameters. | ||
299 | public virtual void SetVehicle(object pvdata) | ||
300 | { | ||
301 | VehicleData vdata = (VehicleData)pvdata; | ||
302 | // vehicleActor.ProcessSetVehicle((VehicleData)vdata); | ||
303 | |||
304 | this.VehicleType = (int)vdata.m_type; | ||
305 | this.VehicleFlags(-1, false); // clears all flags | ||
306 | this.VehicleFlags((int)vdata.m_flags, false); | ||
307 | |||
308 | // Linear properties | ||
309 | this.VehicleVectorParam((int)Vehicle.LINEAR_MOTOR_DIRECTION, vdata.m_linearMotorDirection); | ||
310 | this.VehicleVectorParam((int)Vehicle.LINEAR_FRICTION_TIMESCALE, vdata.m_linearFrictionTimescale); | ||
311 | this.VehicleFloatParam((int)Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE, vdata.m_linearMotorDecayTimescale); | ||
312 | this.VehicleFloatParam((int)Vehicle.LINEAR_MOTOR_TIMESCALE, vdata.m_linearMotorTimescale); | ||
313 | this.VehicleVectorParam((int)Vehicle.LINEAR_MOTOR_OFFSET, vdata.m_linearMotorOffset); | ||
314 | |||
315 | //Angular properties | ||
316 | this.VehicleVectorParam((int)Vehicle.ANGULAR_MOTOR_DIRECTION, vdata.m_angularMotorDirection); | ||
317 | this.VehicleFloatParam((int)Vehicle.ANGULAR_MOTOR_TIMESCALE, vdata.m_angularMotorTimescale); | ||
318 | this.VehicleFloatParam((int)Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE, vdata.m_angularMotorDecayTimescale); | ||
319 | this.VehicleVectorParam((int)Vehicle.ANGULAR_FRICTION_TIMESCALE, vdata.m_angularFrictionTimescale); | ||
320 | |||
321 | //Deflection properties | ||
322 | this.VehicleFloatParam((int)Vehicle.ANGULAR_DEFLECTION_EFFICIENCY, vdata.m_angularDeflectionEfficiency); | ||
323 | this.VehicleFloatParam((int)Vehicle.ANGULAR_DEFLECTION_TIMESCALE, vdata.m_angularDeflectionTimescale); | ||
324 | this.VehicleFloatParam((int)Vehicle.LINEAR_DEFLECTION_EFFICIENCY, vdata.m_linearDeflectionEfficiency); | ||
325 | this.VehicleFloatParam((int)Vehicle.LINEAR_DEFLECTION_TIMESCALE, vdata.m_linearDeflectionTimescale); | ||
326 | |||
327 | //Banking properties | ||
328 | this.VehicleFloatParam((int)Vehicle.BANKING_EFFICIENCY, vdata.m_bankingEfficiency); | ||
329 | this.VehicleFloatParam((int)Vehicle.BANKING_MIX, vdata.m_bankingMix); | ||
330 | this.VehicleFloatParam((int)Vehicle.BANKING_TIMESCALE, vdata.m_bankingTimescale); | ||
331 | |||
332 | //Hover and Buoyancy properties | ||
333 | this.VehicleFloatParam((int)Vehicle.HOVER_HEIGHT, vdata.m_VhoverHeight); | ||
334 | this.VehicleFloatParam((int)Vehicle.HOVER_EFFICIENCY, vdata.m_VhoverEfficiency); | ||
335 | this.VehicleFloatParam((int)Vehicle.HOVER_TIMESCALE, vdata.m_VhoverTimescale); | ||
336 | this.VehicleFloatParam((int)Vehicle.BUOYANCY, vdata.m_VehicleBuoyancy); | ||
337 | |||
338 | //Attractor properties | ||
339 | this.VehicleFloatParam((int)Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, vdata.m_verticalAttractionEfficiency); | ||
340 | this.VehicleFloatParam((int)Vehicle.VERTICAL_ATTRACTION_TIMESCALE, vdata.m_verticalAttractionTimescale); | ||
341 | |||
342 | this.VehicleRotationParam((int)Vehicle.REFERENCE_FRAME, vdata.m_referenceFrame); | ||
343 | } | ||
344 | |||
345 | |||
298 | /// <summary> | 346 | /// <summary> |
299 | /// Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more | 347 | /// Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more |
300 | /// </summary> | 348 | /// </summary> |