aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Framework/Scenes/SOGVehicle.cs431
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs98
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs42
3 files changed, 541 insertions, 30 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SOGVehicle.cs b/OpenSim/Region/Framework/Scenes/SOGVehicle.cs
new file mode 100644
index 0000000..d6e9a3a
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/SOGVehicle.cs
@@ -0,0 +1,431 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenMetaverse;
30using OpenSim.Framework;
31using OpenSim.Region.Physics.Manager;
32
33
34namespace OpenSim.Region.Framework.Scenes
35{
36 public class SOGVehicle
37 {
38 public Vehicle Type
39 {
40 get { return m_type; }
41 }
42 private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier
43 private Quaternion m_RollreferenceFrame = Quaternion.Identity; // what hell is this ?
44
45 private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind
46
47 private VehicleFlag m_flags = (VehicleFlag)0;
48 private Vector3 m_BlockingEndPoint = Vector3.Zero; // not sl
49
50 // Linear properties
51 private Vector3 m_linearMotorDirection = Vector3.Zero; // velocity requested by LSL, decayed by time
52 private Vector3 m_linearFrictionTimescale = new Vector3(1000, 1000, 1000);
53 private float m_linearMotorDecayTimescale = 120;
54 private float m_linearMotorTimescale = 1000;
55 private Vector3 m_linearMotorOffset = Vector3.Zero;
56
57 //Angular properties
58 private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor
59 private float m_angularMotorTimescale = 1000; // motor angular velocity ramp up rate
60 private float m_angularMotorDecayTimescale = 120; // motor angular velocity decay rate
61 private Vector3 m_angularFrictionTimescale = new Vector3(1000, 1000, 1000); // body angular velocity decay rate
62
63 //Deflection properties
64 private float m_angularDeflectionEfficiency = 0;
65 private float m_angularDeflectionTimescale = 1000;
66 private float m_linearDeflectionEfficiency = 0;
67 private float m_linearDeflectionTimescale = 1000;
68
69 //Banking properties
70 private float m_bankingEfficiency = 0;
71 private float m_bankingMix = 0;
72 private float m_bankingTimescale = 0;
73
74 //Hover and Buoyancy properties
75 private float m_VhoverHeight = 0f;
76 private float m_VhoverEfficiency = 0f;
77 private float m_VhoverTimescale = 1000f;
78 private float m_VehicleBuoyancy = 0f;
79
80 //Attractor properties
81 private float m_verticalAttractionEfficiency = 1.0f; // damped
82 private float m_verticalAttractionTimescale = 1000f; // Timescale > 300 means no vert attractor.
83
84 public void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
85 {
86 float len;
87 float timestep = 0.01f;
88 switch (pParam)
89 {
90 case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY:
91 if (pValue < 0f) pValue = 0f;
92 if (pValue > 1f) pValue = 1f;
93 m_angularDeflectionEfficiency = pValue;
94 break;
95 case Vehicle.ANGULAR_DEFLECTION_TIMESCALE:
96 if (pValue < timestep) pValue = timestep;
97 m_angularDeflectionTimescale = pValue;
98 break;
99 case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE:
100 if (pValue < timestep) pValue = timestep;
101 else if (pValue > 120) pValue = 120;
102 m_angularMotorDecayTimescale = pValue;
103 break;
104 case Vehicle.ANGULAR_MOTOR_TIMESCALE:
105 if (pValue < timestep) pValue = timestep;
106 m_angularMotorTimescale = pValue;
107 break;
108 case Vehicle.BANKING_EFFICIENCY:
109 if (pValue < -1f) pValue = -1f;
110 if (pValue > 1f) pValue = 1f;
111 m_bankingEfficiency = pValue;
112 break;
113 case Vehicle.BANKING_MIX:
114 if (pValue < 0f) pValue = 0f;
115 if (pValue > 1f) pValue = 1f;
116 m_bankingMix = pValue;
117 break;
118 case Vehicle.BANKING_TIMESCALE:
119 if (pValue < timestep) pValue = timestep;
120 m_bankingTimescale = pValue;
121 break;
122 case Vehicle.BUOYANCY:
123 if (pValue < -1f) pValue = -1f;
124 if (pValue > 1f) pValue = 1f;
125 m_VehicleBuoyancy = pValue;
126 break;
127 case Vehicle.HOVER_EFFICIENCY:
128 if (pValue < 0f) pValue = 0f;
129 if (pValue > 1f) pValue = 1f;
130 m_VhoverEfficiency = pValue;
131 break;
132 case Vehicle.HOVER_HEIGHT:
133 m_VhoverHeight = pValue;
134 break;
135 case Vehicle.HOVER_TIMESCALE:
136 if (pValue < timestep) pValue = timestep;
137 m_VhoverTimescale = pValue;
138 break;
139 case Vehicle.LINEAR_DEFLECTION_EFFICIENCY:
140 if (pValue < 0f) pValue = 0f;
141 if (pValue > 1f) pValue = 1f;
142 m_linearDeflectionEfficiency = pValue;
143 break;
144 case Vehicle.LINEAR_DEFLECTION_TIMESCALE:
145 if (pValue < timestep) pValue = timestep;
146 m_linearDeflectionTimescale = pValue;
147 break;
148 case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE:
149 // if (pValue < timestep) pValue = timestep;
150 // try to make impulses to work a bit better
151 if (pValue < timestep) pValue = timestep;
152 else if (pValue > 120) pValue = 120;
153 m_linearMotorDecayTimescale = pValue;
154 break;
155 case Vehicle.LINEAR_MOTOR_TIMESCALE:
156 if (pValue < timestep) pValue = timestep;
157 m_linearMotorTimescale = pValue;
158 break;
159 case Vehicle.VERTICAL_ATTRACTION_EFFICIENCY:
160 if (pValue < 0f) pValue = 0f;
161 if (pValue > 1f) pValue = 1f;
162 m_verticalAttractionEfficiency = pValue;
163 break;
164 case Vehicle.VERTICAL_ATTRACTION_TIMESCALE:
165 if (pValue < timestep) pValue = timestep;
166 m_verticalAttractionTimescale = pValue;
167 break;
168
169 // These are vector properties but the engine lets you use a single float value to
170 // set all of the components to the same value
171 case Vehicle.ANGULAR_FRICTION_TIMESCALE:
172 if (pValue < timestep) pValue = timestep;
173 m_angularFrictionTimescale = new Vector3(pValue, pValue, pValue);
174 break;
175 case Vehicle.ANGULAR_MOTOR_DIRECTION:
176 m_angularMotorDirection = new Vector3(pValue, pValue, pValue);
177 len = m_angularMotorDirection.Length();
178 if (len > 12.566f)
179 m_angularMotorDirection *= (12.566f / len);
180 break;
181 case Vehicle.LINEAR_FRICTION_TIMESCALE:
182 if (pValue < timestep) pValue = timestep;
183 m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue);
184 break;
185 case Vehicle.LINEAR_MOTOR_DIRECTION:
186 m_linearMotorDirection = new Vector3(pValue, pValue, pValue);
187 len = m_linearMotorDirection.Length();
188 if (len > 30.0f)
189 m_linearMotorDirection *= (30.0f / len);
190 break;
191 case Vehicle.LINEAR_MOTOR_OFFSET:
192 m_linearMotorOffset = new Vector3(pValue, pValue, pValue);
193 len = m_linearMotorOffset.Length();
194 if (len > 100.0f)
195 m_linearMotorOffset *= (100.0f / len);
196 break;
197 }
198 }//end ProcessFloatVehicleParam
199
200 public void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue)
201 {
202 float len;
203 float timestep = 0.01f;
204 switch (pParam)
205 {
206 case Vehicle.ANGULAR_FRICTION_TIMESCALE:
207 if (pValue.X < timestep) pValue.X = timestep;
208 if (pValue.Y < timestep) pValue.Y = timestep;
209 if (pValue.Z < timestep) pValue.Z = timestep;
210
211 m_angularFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
212 break;
213 case Vehicle.ANGULAR_MOTOR_DIRECTION:
214 m_angularMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z);
215 // Limit requested angular speed to 2 rps= 4 pi rads/sec
216 len = m_angularMotorDirection.Length();
217 if (len > 12.566f)
218 m_angularMotorDirection *= (12.566f / len);
219 break;
220 case Vehicle.LINEAR_FRICTION_TIMESCALE:
221 if (pValue.X < timestep) pValue.X = timestep;
222 if (pValue.Y < timestep) pValue.Y = timestep;
223 if (pValue.Z < timestep) pValue.Z = timestep;
224 m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
225 break;
226 case Vehicle.LINEAR_MOTOR_DIRECTION:
227 m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z);
228 len = m_linearMotorDirection.Length();
229 if (len > 30.0f)
230 m_linearMotorDirection *= (30.0f / len);
231 break;
232 case Vehicle.LINEAR_MOTOR_OFFSET:
233 m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z);
234 len = m_linearMotorOffset.Length();
235 if (len > 100.0f)
236 m_linearMotorOffset *= (100.0f / len);
237 break;
238 case Vehicle.BLOCK_EXIT:
239 m_BlockingEndPoint = new Vector3(pValue.X, pValue.Y, pValue.Z);
240 break;
241 }
242 }//end ProcessVectorVehicleParam
243
244 public void ProcessRotationVehicleParam(Vehicle pParam, Quaternion pValue)
245 {
246 switch (pParam)
247 {
248 case Vehicle.REFERENCE_FRAME:
249 m_referenceFrame = Quaternion.Inverse(pValue);
250 break;
251 case Vehicle.ROLL_FRAME:
252 m_RollreferenceFrame = pValue;
253 break;
254 }
255 }//end ProcessRotationVehicleParam
256
257 public void ProcessVehicleFlags(int pParam, bool remove)
258 {
259 if (remove)
260 {
261 m_flags &= ~((VehicleFlag)pParam);
262 }
263 else
264 {
265 m_flags |= (VehicleFlag)pParam;
266 }
267 }//end ProcessVehicleFlags
268
269 public void ProcessTypeChange(Vehicle pType)
270 {
271 m_linearMotorDirection = Vector3.Zero;
272 m_angularMotorDirection = Vector3.Zero;
273
274 m_BlockingEndPoint = Vector3.Zero;
275 m_RollreferenceFrame = Quaternion.Identity;
276 m_linearMotorOffset = Vector3.Zero;
277
278 m_referenceFrame = Quaternion.Identity;
279
280 // Set Defaults For Type
281 m_type = pType;
282 switch (pType)
283 {
284 case Vehicle.TYPE_NONE: // none sense this will never exist
285 m_linearFrictionTimescale = new Vector3(1000, 1000, 1000);
286 m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
287 m_linearMotorTimescale = 1000;
288 m_linearMotorDecayTimescale = 120;
289 m_angularMotorTimescale = 1000;
290 m_angularMotorDecayTimescale = 1000;
291 m_VhoverHeight = 0;
292 m_VhoverTimescale = 1000;
293 m_VehicleBuoyancy = 0;
294 m_flags = (VehicleFlag)0;
295 break;
296
297 case Vehicle.TYPE_SLED:
298 m_linearFrictionTimescale = new Vector3(30, 1, 1000);
299 m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
300 m_linearMotorTimescale = 1000;
301 m_linearMotorDecayTimescale = 120;
302 m_angularMotorTimescale = 1000;
303 m_angularMotorDecayTimescale = 120;
304 m_VhoverHeight = 0;
305 m_VhoverEfficiency = 1;
306 m_VhoverTimescale = 10;
307 m_VehicleBuoyancy = 0;
308 m_linearDeflectionEfficiency = 1;
309 m_linearDeflectionTimescale = 1;
310 m_angularDeflectionEfficiency = 0;
311 m_angularDeflectionTimescale = 1000;
312 m_bankingEfficiency = 0;
313 m_bankingMix = 1;
314 m_bankingTimescale = 10;
315 m_flags &=
316 ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
317 VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY);
318 m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP);
319 break;
320 case Vehicle.TYPE_CAR:
321 m_linearFrictionTimescale = new Vector3(100, 2, 1000);
322 m_angularFrictionTimescale = new Vector3(1000, 1000, 1000);
323 m_linearMotorTimescale = 1;
324 m_linearMotorDecayTimescale = 60;
325 m_angularMotorTimescale = 1;
326 m_angularMotorDecayTimescale = 0.8f;
327 m_VhoverHeight = 0;
328 m_VhoverEfficiency = 0;
329 m_VhoverTimescale = 1000;
330 m_VehicleBuoyancy = 0;
331 m_linearDeflectionEfficiency = 1;
332 m_linearDeflectionTimescale = 2;
333 m_angularDeflectionEfficiency = 0;
334 m_angularDeflectionTimescale = 10;
335 m_verticalAttractionEfficiency = 1f;
336 m_verticalAttractionTimescale = 10f;
337 m_bankingEfficiency = -0.2f;
338 m_bankingMix = 1;
339 m_bankingTimescale = 1;
340 m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT);
341 m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY |
342 VehicleFlag.LIMIT_MOTOR_UP | VehicleFlag.HOVER_UP_ONLY);
343 break;
344 case Vehicle.TYPE_BOAT:
345 m_linearFrictionTimescale = new Vector3(10, 3, 2);
346 m_angularFrictionTimescale = new Vector3(10, 10, 10);
347 m_linearMotorTimescale = 5;
348 m_linearMotorDecayTimescale = 60;
349 m_angularMotorTimescale = 4;
350 m_angularMotorDecayTimescale = 4;
351 m_VhoverHeight = 0;
352 m_VhoverEfficiency = 0.5f;
353 m_VhoverTimescale = 2;
354 m_VehicleBuoyancy = 1;
355 m_linearDeflectionEfficiency = 0.5f;
356 m_linearDeflectionTimescale = 3;
357 m_angularDeflectionEfficiency = 0.5f;
358 m_angularDeflectionTimescale = 5;
359 m_verticalAttractionEfficiency = 0.5f;
360 m_verticalAttractionTimescale = 5f;
361 m_bankingEfficiency = -0.3f;
362 m_bankingMix = 0.8f;
363 m_bankingTimescale = 1;
364 m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY |
365 VehicleFlag.HOVER_GLOBAL_HEIGHT |
366 VehicleFlag.HOVER_UP_ONLY |
367 VehicleFlag.LIMIT_ROLL_ONLY);
368 m_flags |= (VehicleFlag.NO_DEFLECTION_UP |
369 VehicleFlag.LIMIT_MOTOR_UP |
370 VehicleFlag.HOVER_WATER_ONLY);
371 break;
372 case Vehicle.TYPE_AIRPLANE:
373 m_linearFrictionTimescale = new Vector3(200, 10, 5);
374 m_angularFrictionTimescale = new Vector3(20, 20, 20);
375 m_linearMotorTimescale = 2;
376 m_linearMotorDecayTimescale = 60;
377 m_angularMotorTimescale = 4;
378 m_angularMotorDecayTimescale = 8;
379 m_VhoverHeight = 0;
380 m_VhoverEfficiency = 0.5f;
381 m_VhoverTimescale = 1000;
382 m_VehicleBuoyancy = 0;
383 m_linearDeflectionEfficiency = 0.5f;
384 m_linearDeflectionTimescale = 0.5f;
385 m_angularDeflectionEfficiency = 1;
386 m_angularDeflectionTimescale = 2;
387 m_verticalAttractionEfficiency = 0.9f;
388 m_verticalAttractionTimescale = 2f;
389 m_bankingEfficiency = 1;
390 m_bankingMix = 0.7f;
391 m_bankingTimescale = 2;
392 m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY |
393 VehicleFlag.HOVER_TERRAIN_ONLY |
394 VehicleFlag.HOVER_GLOBAL_HEIGHT |
395 VehicleFlag.HOVER_UP_ONLY |
396 VehicleFlag.NO_DEFLECTION_UP |
397 VehicleFlag.LIMIT_MOTOR_UP);
398 m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY);
399 break;
400 case Vehicle.TYPE_BALLOON:
401 m_linearFrictionTimescale = new Vector3(5, 5, 5);
402 m_angularFrictionTimescale = new Vector3(10, 10, 10);
403 m_linearMotorTimescale = 5;
404 m_linearMotorDecayTimescale = 60;
405 m_angularMotorTimescale = 6;
406 m_angularMotorDecayTimescale = 10;
407 m_VhoverHeight = 5;
408 m_VhoverEfficiency = 0.8f;
409 m_VhoverTimescale = 10;
410 m_VehicleBuoyancy = 1;
411 m_linearDeflectionEfficiency = 0;
412 m_linearDeflectionTimescale = 5;
413 m_angularDeflectionEfficiency = 0;
414 m_angularDeflectionTimescale = 5;
415 m_verticalAttractionEfficiency = 0f;
416 m_verticalAttractionTimescale = 1000f;
417 m_bankingEfficiency = 0;
418 m_bankingMix = 0.7f;
419 m_bankingTimescale = 5;
420 m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY |
421 VehicleFlag.HOVER_TERRAIN_ONLY |
422 VehicleFlag.HOVER_UP_ONLY |
423 VehicleFlag.NO_DEFLECTION_UP |
424 VehicleFlag.LIMIT_MOTOR_UP);
425 m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY |
426 VehicleFlag.HOVER_GLOBAL_HEIGHT);
427 break;
428 }
429 }
430 }
431} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 53edcd6..1bac4d8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -43,6 +43,7 @@ using OpenSim.Region.Framework.Scenes.Serialization;
43 43
44namespace OpenSim.Region.Framework.Scenes 44namespace OpenSim.Region.Framework.Scenes
45{ 45{
46
46 [Flags] 47 [Flags]
47 public enum scriptEvents 48 public enum scriptEvents
48 { 49 {
@@ -114,6 +115,90 @@ namespace OpenSim.Region.Framework.Scenes
114 private bool m_suspendUpdates; 115 private bool m_suspendUpdates;
115 private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>(); 116 private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>();
116 117
118 private SOGVehicle m_vehicle = null;
119
120 public int VehicleType
121 {
122 get
123 {
124 if (m_vehicle == null)
125 return (int)Vehicle.TYPE_NONE;
126 else
127 return (int)m_vehicle.Type;
128 }
129 set
130 {
131 m_vehicle = null;
132 if (value == (int)Vehicle.TYPE_NONE)
133 {
134 if (RootPart.PhysActor != null)
135 RootPart.PhysActor.VehicleType = (int)Vehicle.TYPE_NONE;
136 return;
137 }
138 m_vehicle = new SOGVehicle();
139 m_vehicle.ProcessTypeChange((Vehicle)value);
140 {
141 if (RootPart.PhysActor != null)
142 RootPart.PhysActor.VehicleType = value;
143 return;
144 }
145
146 }
147 }
148
149 public void SetVehicleFlags(int param, bool remove)
150 {
151 if (m_vehicle == null)
152 return;
153
154 m_vehicle.ProcessVehicleFlags(param, remove);
155
156 if (RootPart.PhysActor != null)
157 {
158 RootPart.PhysActor.VehicleFlags(param, remove);
159 }
160 }
161
162 public void SetVehicleFloatParam(int param, float value)
163 {
164 if (m_vehicle == null)
165 return;
166
167 m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value);
168
169 if (RootPart.PhysActor != null)
170 {
171 RootPart.PhysActor.VehicleFloatParam(param, value);
172 }
173 }
174
175 public void SetVehicleVectorParam(int param, Vector3 value)
176 {
177 if (m_vehicle == null)
178 return;
179
180 m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value);
181
182 if (RootPart.PhysActor != null)
183 {
184 RootPart.PhysActor.VehicleVectorParam(param, value);
185 }
186 }
187
188 public void SetVehicleRotationParam(int param, Quaternion rotation)
189 {
190 if (m_vehicle == null)
191 return;
192
193 m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation);
194
195 if (RootPart.PhysActor != null)
196 {
197 RootPart.PhysActor.VehicleRotationParam(param, rotation);
198 }
199 }
200
201
117 public bool areUpdatesSuspended 202 public bool areUpdatesSuspended
118 { 203 {
119 get 204 get
@@ -1678,10 +1763,6 @@ namespace OpenSim.Region.Framework.Scenes
1678 /// </summary> 1763 /// </summary>
1679 public void ApplyPhysics() 1764 public void ApplyPhysics()
1680 { 1765 {
1681 // Apply physics to the root prim
1682 // m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive);
1683
1684 // Apply physics to child prims
1685 SceneObjectPart[] parts = m_parts.GetArray(); 1766 SceneObjectPart[] parts = m_parts.GetArray();
1686 if (parts.Length > 1) 1767 if (parts.Length > 1)
1687 { 1768 {
@@ -1689,18 +1770,21 @@ namespace OpenSim.Region.Framework.Scenes
1689 1770
1690 // Apply physics to the root prim 1771 // Apply physics to the root prim
1691 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, true); 1772 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, true);
1773
1774
1692 for (int i = 0; i < parts.Length; i++) 1775 for (int i = 0; i < parts.Length; i++)
1693 { 1776 {
1694 SceneObjectPart part = parts[i]; 1777 SceneObjectPart part = parts[i];
1695 if (part.LocalId != m_rootPart.LocalId) 1778 if (part.LocalId != m_rootPart.LocalId)
1696// part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive);
1697 part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive, true); 1779 part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive, true);
1698
1699 } 1780 }
1700 // Hack to get the physics scene geometries in the right spot 1781 // Hack to get the physics scene geometries in the right spot
1701// ResetChildPrimPhysicsPositions(); 1782// ResetChildPrimPhysicsPositions();
1702 if (m_rootPart.PhysActor != null) 1783 if (m_rootPart.PhysActor != null)
1784 {
1703 m_rootPart.PhysActor.Building = false; 1785 m_rootPart.PhysActor.Building = false;
1786
1787 }
1704 } 1788 }
1705 else 1789 else
1706 { 1790 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 19dedde..6438694 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3170,34 +3170,37 @@ namespace OpenSim.Region.Framework.Scenes
3170 3170
3171 public void SetVehicleType(int type) 3171 public void SetVehicleType(int type)
3172 { 3172 {
3173 if (PhysActor != null) 3173 if (ParentGroup.IsDeleted)
3174 { 3174 return;
3175 PhysActor.VehicleType = type; 3175 ParentGroup.VehicleType = type;
3176 } 3176 }
3177
3178 public void SetVehicleFlags(int param, bool remove)
3179 {
3180 if (ParentGroup.IsDeleted)
3181 return;
3182 ParentGroup.SetVehicleFlags(param, remove);
3177 } 3183 }
3178 3184
3179 public void SetVehicleFloatParam(int param, float value) 3185 public void SetVehicleFloatParam(int param, float value)
3180 { 3186 {
3181 if (PhysActor != null) 3187 if (ParentGroup.IsDeleted)
3182 { 3188 return;
3183 PhysActor.VehicleFloatParam(param, value); 3189 ParentGroup.SetVehicleFloatParam(param, value);
3184 }
3185 } 3190 }
3186 3191
3187 public void SetVehicleVectorParam(int param, Vector3 value) 3192 public void SetVehicleVectorParam(int param, Vector3 value)
3188 { 3193 {
3189 if (PhysActor != null) 3194 if (ParentGroup.IsDeleted)
3190 { 3195 return;
3191 PhysActor.VehicleVectorParam(param, value); 3196 ParentGroup.SetVehicleVectorParam(param, value);
3192 }
3193 } 3197 }
3194 3198
3195 public void SetVehicleRotationParam(int param, Quaternion rotation) 3199 public void SetVehicleRotationParam(int param, Quaternion rotation)
3196 { 3200 {
3197 if (PhysActor != null) 3201 if (ParentGroup.IsDeleted)
3198 { 3202 return;
3199 PhysActor.VehicleRotationParam(param, rotation); 3203 ParentGroup.SetVehicleRotationParam(param, rotation);
3200 }
3201 } 3204 }
3202 3205
3203 /// <summary> 3206 /// <summary>
@@ -3381,13 +3384,6 @@ namespace OpenSim.Region.Framework.Scenes
3381 hasProfileCut = hasDimple; // is it the same thing? 3384 hasProfileCut = hasDimple; // is it the same thing?
3382 } 3385 }
3383 3386
3384 public void SetVehicleFlags(int param, bool remove)
3385 {
3386 if (PhysActor != null)
3387 {
3388 PhysActor.VehicleFlags(param, remove);
3389 }
3390 }
3391 3387
3392 public void SetGroup(UUID groupID, IClientAPI client) 3388 public void SetGroup(UUID groupID, IClientAPI client)
3393 { 3389 {