diff options
author | Melanie | 2012-02-19 20:08:01 +0100 |
---|---|---|
committer | Melanie | 2012-02-19 20:08:01 +0100 |
commit | 96409cc2eeb4555609f72c8bc61fbdf4ac3e9933 (patch) | |
tree | 394a7a07ff913c8efa390399c190d5c65bf8f95b /OpenSim/Region/Framework/Scenes | |
parent | Merge branch 'master' of ssh://3dhosting.de/var/git/careminster (diff) | |
parent | moved vehicle from SOG to SOP (diff) | |
download | opensim-SC_OLD-96409cc2eeb4555609f72c8bc61fbdf4ac3e9933.zip opensim-SC_OLD-96409cc2eeb4555609f72c8bc61fbdf4ac3e9933.tar.gz opensim-SC_OLD-96409cc2eeb4555609f72c8bc61fbdf4ac3e9933.tar.bz2 opensim-SC_OLD-96409cc2eeb4555609f72c8bc61fbdf4ac3e9933.tar.xz |
Merge branch 'ubitwork'
Conflicts:
OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SOPVehicle.cs | 487 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 54 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 109 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 10 |
5 files changed, 636 insertions, 26 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs new file mode 100644 index 0000000..39786bd --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs | |||
@@ -0,0 +1,487 @@ | |||
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 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Physics.Manager; | ||
32 | using System.Xml; | ||
33 | using OpenSim.Framework.Serialization; | ||
34 | using OpenSim.Framework.Serialization.External; | ||
35 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
36 | |||
37 | namespace OpenSim.Region.Framework.Scenes | ||
38 | { | ||
39 | public class SOPVehicle | ||
40 | { | ||
41 | public VehicleData vd; | ||
42 | |||
43 | public Vehicle Type | ||
44 | { | ||
45 | get { return vd.m_type; } | ||
46 | } | ||
47 | |||
48 | public SOPVehicle() | ||
49 | { | ||
50 | vd = new VehicleData(); | ||
51 | ProcessTypeChange(Vehicle.TYPE_NONE); // is needed? | ||
52 | } | ||
53 | |||
54 | public void ProcessFloatVehicleParam(Vehicle pParam, float pValue) | ||
55 | { | ||
56 | float len; | ||
57 | float timestep = 0.01f; | ||
58 | switch (pParam) | ||
59 | { | ||
60 | case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY: | ||
61 | if (pValue < 0f) pValue = 0f; | ||
62 | if (pValue > 1f) pValue = 1f; | ||
63 | vd.m_angularDeflectionEfficiency = pValue; | ||
64 | break; | ||
65 | case Vehicle.ANGULAR_DEFLECTION_TIMESCALE: | ||
66 | if (pValue < timestep) pValue = timestep; | ||
67 | vd.m_angularDeflectionTimescale = pValue; | ||
68 | break; | ||
69 | case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE: | ||
70 | if (pValue < timestep) pValue = timestep; | ||
71 | else if (pValue > 120) pValue = 120; | ||
72 | vd.m_angularMotorDecayTimescale = pValue; | ||
73 | break; | ||
74 | case Vehicle.ANGULAR_MOTOR_TIMESCALE: | ||
75 | if (pValue < timestep) pValue = timestep; | ||
76 | vd.m_angularMotorTimescale = pValue; | ||
77 | break; | ||
78 | case Vehicle.BANKING_EFFICIENCY: | ||
79 | if (pValue < -1f) pValue = -1f; | ||
80 | if (pValue > 1f) pValue = 1f; | ||
81 | vd.m_bankingEfficiency = pValue; | ||
82 | break; | ||
83 | case Vehicle.BANKING_MIX: | ||
84 | if (pValue < 0f) pValue = 0f; | ||
85 | if (pValue > 1f) pValue = 1f; | ||
86 | vd.m_bankingMix = pValue; | ||
87 | break; | ||
88 | case Vehicle.BANKING_TIMESCALE: | ||
89 | if (pValue < timestep) pValue = timestep; | ||
90 | vd.m_bankingTimescale = pValue; | ||
91 | break; | ||
92 | case Vehicle.BUOYANCY: | ||
93 | if (pValue < -1f) pValue = -1f; | ||
94 | if (pValue > 1f) pValue = 1f; | ||
95 | vd.m_VehicleBuoyancy = pValue; | ||
96 | break; | ||
97 | case Vehicle.HOVER_EFFICIENCY: | ||
98 | if (pValue < 0f) pValue = 0f; | ||
99 | if (pValue > 1f) pValue = 1f; | ||
100 | vd.m_VhoverEfficiency = pValue; | ||
101 | break; | ||
102 | case Vehicle.HOVER_HEIGHT: | ||
103 | vd.m_VhoverHeight = pValue; | ||
104 | break; | ||
105 | case Vehicle.HOVER_TIMESCALE: | ||
106 | if (pValue < timestep) pValue = timestep; | ||
107 | vd.m_VhoverTimescale = pValue; | ||
108 | break; | ||
109 | case Vehicle.LINEAR_DEFLECTION_EFFICIENCY: | ||
110 | if (pValue < 0f) pValue = 0f; | ||
111 | if (pValue > 1f) pValue = 1f; | ||
112 | vd.m_linearDeflectionEfficiency = pValue; | ||
113 | break; | ||
114 | case Vehicle.LINEAR_DEFLECTION_TIMESCALE: | ||
115 | if (pValue < timestep) pValue = timestep; | ||
116 | vd.m_linearDeflectionTimescale = pValue; | ||
117 | break; | ||
118 | case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE: | ||
119 | // if (pValue < timestep) pValue = timestep; | ||
120 | // try to make impulses to work a bit better | ||
121 | if (pValue < timestep) pValue = timestep; | ||
122 | else if (pValue > 120) pValue = 120; | ||
123 | vd.m_linearMotorDecayTimescale = pValue; | ||
124 | break; | ||
125 | case Vehicle.LINEAR_MOTOR_TIMESCALE: | ||
126 | if (pValue < timestep) pValue = timestep; | ||
127 | vd.m_linearMotorTimescale = pValue; | ||
128 | break; | ||
129 | case Vehicle.VERTICAL_ATTRACTION_EFFICIENCY: | ||
130 | if (pValue < 0f) pValue = 0f; | ||
131 | if (pValue > 1f) pValue = 1f; | ||
132 | vd.m_verticalAttractionEfficiency = pValue; | ||
133 | break; | ||
134 | case Vehicle.VERTICAL_ATTRACTION_TIMESCALE: | ||
135 | if (pValue < timestep) pValue = timestep; | ||
136 | vd.m_verticalAttractionTimescale = pValue; | ||
137 | break; | ||
138 | |||
139 | // These are vector properties but the engine lets you use a single float value to | ||
140 | // set all of the components to the same value | ||
141 | case Vehicle.ANGULAR_FRICTION_TIMESCALE: | ||
142 | if (pValue < timestep) pValue = timestep; | ||
143 | vd.m_angularFrictionTimescale = new Vector3(pValue, pValue, pValue); | ||
144 | break; | ||
145 | case Vehicle.ANGULAR_MOTOR_DIRECTION: | ||
146 | vd.m_angularMotorDirection = new Vector3(pValue, pValue, pValue); | ||
147 | len = vd.m_angularMotorDirection.Length(); | ||
148 | if (len > 12.566f) | ||
149 | vd.m_angularMotorDirection *= (12.566f / len); | ||
150 | break; | ||
151 | case Vehicle.LINEAR_FRICTION_TIMESCALE: | ||
152 | if (pValue < timestep) pValue = timestep; | ||
153 | vd.m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue); | ||
154 | break; | ||
155 | case Vehicle.LINEAR_MOTOR_DIRECTION: | ||
156 | vd.m_linearMotorDirection = new Vector3(pValue, pValue, pValue); | ||
157 | len = vd.m_linearMotorDirection.Length(); | ||
158 | if (len > 30.0f) | ||
159 | vd.m_linearMotorDirection *= (30.0f / len); | ||
160 | break; | ||
161 | case Vehicle.LINEAR_MOTOR_OFFSET: | ||
162 | vd.m_linearMotorOffset = new Vector3(pValue, pValue, pValue); | ||
163 | len = vd.m_linearMotorOffset.Length(); | ||
164 | if (len > 100.0f) | ||
165 | vd.m_linearMotorOffset *= (100.0f / len); | ||
166 | break; | ||
167 | } | ||
168 | }//end ProcessFloatVehicleParam | ||
169 | |||
170 | public void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue) | ||
171 | { | ||
172 | float len; | ||
173 | float timestep = 0.01f; | ||
174 | switch (pParam) | ||
175 | { | ||
176 | case Vehicle.ANGULAR_FRICTION_TIMESCALE: | ||
177 | if (pValue.X < timestep) pValue.X = timestep; | ||
178 | if (pValue.Y < timestep) pValue.Y = timestep; | ||
179 | if (pValue.Z < timestep) pValue.Z = timestep; | ||
180 | |||
181 | vd.m_angularFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); | ||
182 | break; | ||
183 | case Vehicle.ANGULAR_MOTOR_DIRECTION: | ||
184 | vd.m_angularMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); | ||
185 | // Limit requested angular speed to 2 rps= 4 pi rads/sec | ||
186 | len = vd.m_angularMotorDirection.Length(); | ||
187 | if (len > 12.566f) | ||
188 | vd.m_angularMotorDirection *= (12.566f / len); | ||
189 | break; | ||
190 | case Vehicle.LINEAR_FRICTION_TIMESCALE: | ||
191 | if (pValue.X < timestep) pValue.X = timestep; | ||
192 | if (pValue.Y < timestep) pValue.Y = timestep; | ||
193 | if (pValue.Z < timestep) pValue.Z = timestep; | ||
194 | vd.m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); | ||
195 | break; | ||
196 | case Vehicle.LINEAR_MOTOR_DIRECTION: | ||
197 | vd.m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); | ||
198 | len = vd.m_linearMotorDirection.Length(); | ||
199 | if (len > 30.0f) | ||
200 | vd.m_linearMotorDirection *= (30.0f / len); | ||
201 | break; | ||
202 | case Vehicle.LINEAR_MOTOR_OFFSET: | ||
203 | vd.m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z); | ||
204 | len = vd.m_linearMotorOffset.Length(); | ||
205 | if (len > 100.0f) | ||
206 | vd.m_linearMotorOffset *= (100.0f / len); | ||
207 | break; | ||
208 | } | ||
209 | }//end ProcessVectorVehicleParam | ||
210 | |||
211 | public void ProcessRotationVehicleParam(Vehicle pParam, Quaternion pValue) | ||
212 | { | ||
213 | switch (pParam) | ||
214 | { | ||
215 | case Vehicle.REFERENCE_FRAME: | ||
216 | vd.m_referenceFrame = Quaternion.Inverse(pValue); | ||
217 | break; | ||
218 | } | ||
219 | }//end ProcessRotationVehicleParam | ||
220 | |||
221 | public void ProcessVehicleFlags(int pParam, bool remove) | ||
222 | { | ||
223 | if (remove) | ||
224 | { | ||
225 | vd.m_flags &= ~((VehicleFlag)pParam); | ||
226 | } | ||
227 | else | ||
228 | { | ||
229 | vd.m_flags |= (VehicleFlag)pParam; | ||
230 | } | ||
231 | }//end ProcessVehicleFlags | ||
232 | |||
233 | public void ProcessTypeChange(Vehicle pType) | ||
234 | { | ||
235 | vd.m_linearMotorDirection = Vector3.Zero; | ||
236 | vd.m_angularMotorDirection = Vector3.Zero; | ||
237 | vd.m_linearMotorOffset = Vector3.Zero; | ||
238 | vd.m_referenceFrame = Quaternion.Identity; | ||
239 | |||
240 | // Set Defaults For Type | ||
241 | vd.m_type = pType; | ||
242 | switch (pType) | ||
243 | { | ||
244 | case Vehicle.TYPE_NONE: | ||
245 | vd.m_linearFrictionTimescale = new Vector3(1000, 1000, 1000); | ||
246 | vd.m_angularFrictionTimescale = new Vector3(1000, 1000, 1000); | ||
247 | vd.m_linearMotorTimescale = 1000; | ||
248 | vd.m_linearMotorDecayTimescale = 120; | ||
249 | vd.m_angularMotorTimescale = 1000; | ||
250 | vd.m_angularMotorDecayTimescale = 1000; | ||
251 | vd.m_VhoverHeight = 0; | ||
252 | vd.m_VhoverEfficiency = 1; | ||
253 | vd.m_VhoverTimescale = 1000; | ||
254 | vd.m_VehicleBuoyancy = 0; | ||
255 | vd.m_linearDeflectionEfficiency = 0; | ||
256 | vd.m_linearDeflectionTimescale = 1000; | ||
257 | vd.m_angularDeflectionEfficiency = 0; | ||
258 | vd.m_angularDeflectionTimescale = 1000; | ||
259 | vd.m_bankingEfficiency = 0; | ||
260 | vd.m_bankingMix = 1; | ||
261 | vd.m_bankingTimescale = 1000; | ||
262 | vd.m_verticalAttractionEfficiency = 0; | ||
263 | vd.m_verticalAttractionTimescale = 1000; | ||
264 | |||
265 | vd.m_flags = (VehicleFlag)0; | ||
266 | break; | ||
267 | |||
268 | case Vehicle.TYPE_SLED: | ||
269 | vd.m_linearFrictionTimescale = new Vector3(30, 1, 1000); | ||
270 | vd.m_angularFrictionTimescale = new Vector3(1000, 1000, 1000); | ||
271 | vd.m_linearMotorTimescale = 1000; | ||
272 | vd.m_linearMotorDecayTimescale = 120; | ||
273 | vd.m_angularMotorTimescale = 1000; | ||
274 | vd.m_angularMotorDecayTimescale = 120; | ||
275 | vd.m_VhoverHeight = 0; | ||
276 | vd.m_VhoverEfficiency = 1; | ||
277 | vd.m_VhoverTimescale = 10; | ||
278 | vd.m_VehicleBuoyancy = 0; | ||
279 | vd.m_linearDeflectionEfficiency = 1; | ||
280 | vd.m_linearDeflectionTimescale = 1; | ||
281 | vd.m_angularDeflectionEfficiency = 0; | ||
282 | vd.m_angularDeflectionTimescale = 1000; | ||
283 | vd.m_bankingEfficiency = 0; | ||
284 | vd.m_bankingMix = 1; | ||
285 | vd.m_bankingTimescale = 10; | ||
286 | vd.m_flags &= | ||
287 | ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | | ||
288 | VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY); | ||
289 | vd.m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP); | ||
290 | break; | ||
291 | case Vehicle.TYPE_CAR: | ||
292 | vd.m_linearFrictionTimescale = new Vector3(100, 2, 1000); | ||
293 | vd.m_angularFrictionTimescale = new Vector3(1000, 1000, 1000); | ||
294 | vd.m_linearMotorTimescale = 1; | ||
295 | vd.m_linearMotorDecayTimescale = 60; | ||
296 | vd.m_angularMotorTimescale = 1; | ||
297 | vd.m_angularMotorDecayTimescale = 0.8f; | ||
298 | vd.m_VhoverHeight = 0; | ||
299 | vd.m_VhoverEfficiency = 0; | ||
300 | vd.m_VhoverTimescale = 1000; | ||
301 | vd.m_VehicleBuoyancy = 0; | ||
302 | vd.m_linearDeflectionEfficiency = 1; | ||
303 | vd.m_linearDeflectionTimescale = 2; | ||
304 | vd.m_angularDeflectionEfficiency = 0; | ||
305 | vd.m_angularDeflectionTimescale = 10; | ||
306 | vd.m_verticalAttractionEfficiency = 1f; | ||
307 | vd.m_verticalAttractionTimescale = 10f; | ||
308 | vd.m_bankingEfficiency = -0.2f; | ||
309 | vd.m_bankingMix = 1; | ||
310 | vd.m_bankingTimescale = 1; | ||
311 | vd.m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT); | ||
312 | vd.m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | | ||
313 | VehicleFlag.LIMIT_MOTOR_UP | VehicleFlag.HOVER_UP_ONLY); | ||
314 | break; | ||
315 | case Vehicle.TYPE_BOAT: | ||
316 | vd.m_linearFrictionTimescale = new Vector3(10, 3, 2); | ||
317 | vd.m_angularFrictionTimescale = new Vector3(10, 10, 10); | ||
318 | vd.m_linearMotorTimescale = 5; | ||
319 | vd.m_linearMotorDecayTimescale = 60; | ||
320 | vd.m_angularMotorTimescale = 4; | ||
321 | vd.m_angularMotorDecayTimescale = 4; | ||
322 | vd.m_VhoverHeight = 0; | ||
323 | vd.m_VhoverEfficiency = 0.5f; | ||
324 | vd.m_VhoverTimescale = 2; | ||
325 | vd.m_VehicleBuoyancy = 1; | ||
326 | vd.m_linearDeflectionEfficiency = 0.5f; | ||
327 | vd.m_linearDeflectionTimescale = 3; | ||
328 | vd.m_angularDeflectionEfficiency = 0.5f; | ||
329 | vd.m_angularDeflectionTimescale = 5; | ||
330 | vd.m_verticalAttractionEfficiency = 0.5f; | ||
331 | vd.m_verticalAttractionTimescale = 5f; | ||
332 | vd.m_bankingEfficiency = -0.3f; | ||
333 | vd.m_bankingMix = 0.8f; | ||
334 | vd.m_bankingTimescale = 1; | ||
335 | vd.m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY | | ||
336 | VehicleFlag.HOVER_GLOBAL_HEIGHT | | ||
337 | VehicleFlag.HOVER_UP_ONLY | | ||
338 | VehicleFlag.LIMIT_ROLL_ONLY); | ||
339 | vd.m_flags |= (VehicleFlag.NO_DEFLECTION_UP | | ||
340 | VehicleFlag.LIMIT_MOTOR_UP | | ||
341 | VehicleFlag.HOVER_WATER_ONLY); | ||
342 | break; | ||
343 | case Vehicle.TYPE_AIRPLANE: | ||
344 | vd.m_linearFrictionTimescale = new Vector3(200, 10, 5); | ||
345 | vd.m_angularFrictionTimescale = new Vector3(20, 20, 20); | ||
346 | vd.m_linearMotorTimescale = 2; | ||
347 | vd.m_linearMotorDecayTimescale = 60; | ||
348 | vd.m_angularMotorTimescale = 4; | ||
349 | vd.m_angularMotorDecayTimescale = 8; | ||
350 | vd.m_VhoverHeight = 0; | ||
351 | vd.m_VhoverEfficiency = 0.5f; | ||
352 | vd.m_VhoverTimescale = 1000; | ||
353 | vd.m_VehicleBuoyancy = 0; | ||
354 | vd.m_linearDeflectionEfficiency = 0.5f; | ||
355 | vd.m_linearDeflectionTimescale = 0.5f; | ||
356 | vd.m_angularDeflectionEfficiency = 1; | ||
357 | vd.m_angularDeflectionTimescale = 2; | ||
358 | vd.m_verticalAttractionEfficiency = 0.9f; | ||
359 | vd.m_verticalAttractionTimescale = 2f; | ||
360 | vd.m_bankingEfficiency = 1; | ||
361 | vd.m_bankingMix = 0.7f; | ||
362 | vd.m_bankingTimescale = 2; | ||
363 | vd.m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | | ||
364 | VehicleFlag.HOVER_TERRAIN_ONLY | | ||
365 | VehicleFlag.HOVER_GLOBAL_HEIGHT | | ||
366 | VehicleFlag.HOVER_UP_ONLY | | ||
367 | VehicleFlag.NO_DEFLECTION_UP | | ||
368 | VehicleFlag.LIMIT_MOTOR_UP); | ||
369 | vd.m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY); | ||
370 | break; | ||
371 | case Vehicle.TYPE_BALLOON: | ||
372 | vd.m_linearFrictionTimescale = new Vector3(5, 5, 5); | ||
373 | vd.m_angularFrictionTimescale = new Vector3(10, 10, 10); | ||
374 | vd.m_linearMotorTimescale = 5; | ||
375 | vd.m_linearMotorDecayTimescale = 60; | ||
376 | vd.m_angularMotorTimescale = 6; | ||
377 | vd.m_angularMotorDecayTimescale = 10; | ||
378 | vd.m_VhoverHeight = 5; | ||
379 | vd.m_VhoverEfficiency = 0.8f; | ||
380 | vd.m_VhoverTimescale = 10; | ||
381 | vd.m_VehicleBuoyancy = 1; | ||
382 | vd.m_linearDeflectionEfficiency = 0; | ||
383 | vd.m_linearDeflectionTimescale = 5; | ||
384 | vd.m_angularDeflectionEfficiency = 0; | ||
385 | vd.m_angularDeflectionTimescale = 5; | ||
386 | vd.m_verticalAttractionEfficiency = 0f; | ||
387 | vd.m_verticalAttractionTimescale = 1000f; | ||
388 | vd.m_bankingEfficiency = 0; | ||
389 | vd.m_bankingMix = 0.7f; | ||
390 | vd.m_bankingTimescale = 5; | ||
391 | vd.m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | | ||
392 | VehicleFlag.HOVER_TERRAIN_ONLY | | ||
393 | VehicleFlag.HOVER_UP_ONLY | | ||
394 | VehicleFlag.NO_DEFLECTION_UP | | ||
395 | VehicleFlag.LIMIT_MOTOR_UP); | ||
396 | vd.m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY | | ||
397 | VehicleFlag.HOVER_GLOBAL_HEIGHT); | ||
398 | break; | ||
399 | } | ||
400 | } | ||
401 | public void SetVehicle(PhysicsActor ph) | ||
402 | { | ||
403 | if (ph == null) | ||
404 | return; | ||
405 | ph.SetVehicle(vd); | ||
406 | } | ||
407 | |||
408 | private XmlTextWriter writer; | ||
409 | |||
410 | private void XWint(string name, int i) | ||
411 | { | ||
412 | writer.WriteElementString(name, i.ToString()); | ||
413 | } | ||
414 | |||
415 | private void XWfloat(string name, float f) | ||
416 | { | ||
417 | writer.WriteElementString(name, f.ToString(Utils.EnUsCulture)); | ||
418 | } | ||
419 | |||
420 | private void XWVector(string name, Vector3 vec) | ||
421 | { | ||
422 | writer.WriteStartElement(name); | ||
423 | writer.WriteElementString("X", vec.X.ToString(Utils.EnUsCulture)); | ||
424 | writer.WriteElementString("Y", vec.Y.ToString(Utils.EnUsCulture)); | ||
425 | writer.WriteElementString("Z", vec.Z.ToString(Utils.EnUsCulture)); | ||
426 | writer.WriteEndElement(); | ||
427 | } | ||
428 | |||
429 | private void XWQuat(string name, Quaternion quat) | ||
430 | { | ||
431 | writer.WriteStartElement(name); | ||
432 | writer.WriteElementString("X", quat.X.ToString(Utils.EnUsCulture)); | ||
433 | writer.WriteElementString("Y", quat.Y.ToString(Utils.EnUsCulture)); | ||
434 | writer.WriteElementString("Z", quat.Z.ToString(Utils.EnUsCulture)); | ||
435 | writer.WriteElementString("W", quat.W.ToString(Utils.EnUsCulture)); | ||
436 | writer.WriteEndElement(); | ||
437 | } | ||
438 | |||
439 | public void ToXml2(XmlTextWriter twriter) | ||
440 | { | ||
441 | writer = twriter; | ||
442 | writer.WriteStartElement("SOGVehicle"); | ||
443 | |||
444 | XWint("TYPE", (int)vd.m_type); | ||
445 | XWint("FLAGS", (int)vd.m_flags); | ||
446 | |||
447 | // Linear properties | ||
448 | XWVector("LMDIR", vd.m_linearMotorDirection); | ||
449 | XWVector("LMFTIME", vd.m_linearFrictionTimescale); | ||
450 | XWfloat("LMDTIME", vd.m_linearMotorDecayTimescale); | ||
451 | XWfloat("LMTIME", vd.m_linearMotorTimescale); | ||
452 | XWVector("LMOFF", vd.m_linearMotorOffset); | ||
453 | |||
454 | //Angular properties | ||
455 | XWVector("AMDIR", vd.m_angularMotorDirection); | ||
456 | XWfloat("AMTIME", vd.m_angularMotorTimescale); | ||
457 | XWfloat("AMDTIME", vd.m_angularMotorDecayTimescale); | ||
458 | XWVector("AMFTIME", vd.m_angularFrictionTimescale); | ||
459 | |||
460 | //Deflection properties | ||
461 | XWfloat("ADEFF", vd.m_angularDeflectionEfficiency); | ||
462 | XWfloat("ADTIME", vd.m_angularDeflectionTimescale); | ||
463 | XWfloat("LDEFF", vd.m_linearDeflectionEfficiency); | ||
464 | XWfloat("LDTIME", vd.m_linearDeflectionTimescale); | ||
465 | |||
466 | //Banking properties | ||
467 | XWfloat("BEFF", vd.m_bankingEfficiency); | ||
468 | XWfloat("BMIX", vd.m_bankingMix); | ||
469 | XWfloat("BTIME", vd.m_bankingTimescale); | ||
470 | |||
471 | //Hover and Buoyancy properties | ||
472 | XWfloat("HHEI", vd.m_VhoverHeight); | ||
473 | XWfloat("HEFF", vd.m_VhoverEfficiency); | ||
474 | XWfloat("HTIME", vd.m_VhoverTimescale); | ||
475 | XWfloat("VBUO", vd.m_VehicleBuoyancy); | ||
476 | |||
477 | //Attractor properties | ||
478 | XWfloat("VAEFF", vd.m_verticalAttractionEfficiency); | ||
479 | XWfloat("VATIME", vd.m_verticalAttractionTimescale); | ||
480 | |||
481 | XWQuat("REF_FRAME", vd.m_referenceFrame); | ||
482 | |||
483 | writer.WriteEndElement(); | ||
484 | writer = null; | ||
485 | } | ||
486 | } | ||
487 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7b1ef40..6274e02 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4792,7 +4792,7 @@ Environment.Exit(1); | |||
4792 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 4792 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
4793 | if (wasUsingPhysics) | 4793 | if (wasUsingPhysics) |
4794 | { | 4794 | { |
4795 | jointProxyObject.UpdatePrimFlags(false, false, true, false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock | 4795 | jointProxyObject.UpdatePrimFlags(false, false, true, false,false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock |
4796 | } | 4796 | } |
4797 | } | 4797 | } |
4798 | 4798 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index cbd45c3..2481dd2 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 | ||
44 | namespace OpenSim.Region.Framework.Scenes | 44 | namespace OpenSim.Region.Framework.Scenes |
45 | { | 45 | { |
46 | |||
46 | [Flags] | 47 | [Flags] |
47 | public enum scriptEvents | 48 | public enum scriptEvents |
48 | { | 49 | { |
@@ -1378,7 +1379,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1378 | 1379 | ||
1379 | m_rootPart.SetParentLocalId(0); | 1380 | m_rootPart.SetParentLocalId(0); |
1380 | AttachmentPoint = (byte)0; | 1381 | AttachmentPoint = (byte)0; |
1381 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive); | 1382 | // must check if buildind should be true or false here |
1383 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false); | ||
1382 | HasGroupChanged = true; | 1384 | HasGroupChanged = true; |
1383 | RootPart.Rezzed = DateTime.Now; | 1385 | RootPart.Rezzed = DateTime.Now; |
1384 | RootPart.RemFlag(PrimFlags.TemporaryOnRez); | 1386 | RootPart.RemFlag(PrimFlags.TemporaryOnRez); |
@@ -1677,22 +1679,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1677 | /// </summary> | 1679 | /// </summary> |
1678 | public void ApplyPhysics() | 1680 | public void ApplyPhysics() |
1679 | { | 1681 | { |
1680 | // Apply physics to the root prim | ||
1681 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive); | ||
1682 | |||
1683 | // Apply physics to child prims | ||
1684 | SceneObjectPart[] parts = m_parts.GetArray(); | 1682 | SceneObjectPart[] parts = m_parts.GetArray(); |
1685 | if (parts.Length > 1) | 1683 | if (parts.Length > 1) |
1686 | { | 1684 | { |
1685 | ResetChildPrimPhysicsPositions(); | ||
1686 | |||
1687 | // Apply physics to the root prim | ||
1688 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, true); | ||
1689 | |||
1690 | |||
1687 | for (int i = 0; i < parts.Length; i++) | 1691 | for (int i = 0; i < parts.Length; i++) |
1688 | { | 1692 | { |
1689 | SceneObjectPart part = parts[i]; | 1693 | SceneObjectPart part = parts[i]; |
1690 | if (part.LocalId != m_rootPart.LocalId) | 1694 | if (part.LocalId != m_rootPart.LocalId) |
1691 | part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive); | 1695 | part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive, true); |
1692 | } | 1696 | } |
1693 | |||
1694 | // Hack to get the physics scene geometries in the right spot | 1697 | // Hack to get the physics scene geometries in the right spot |
1695 | ResetChildPrimPhysicsPositions(); | 1698 | // ResetChildPrimPhysicsPositions(); |
1699 | if (m_rootPart.PhysActor != null) | ||
1700 | { | ||
1701 | m_rootPart.PhysActor.Building = false; | ||
1702 | } | ||
1703 | } | ||
1704 | else | ||
1705 | { | ||
1706 | // Apply physics to the root prim | ||
1707 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false); | ||
1696 | } | 1708 | } |
1697 | } | 1709 | } |
1698 | 1710 | ||
@@ -1863,6 +1875,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1863 | /// <returns></returns> | 1875 | /// <returns></returns> |
1864 | public SceneObjectGroup Copy(bool userExposed) | 1876 | public SceneObjectGroup Copy(bool userExposed) |
1865 | { | 1877 | { |
1878 | m_dupeInProgress = true; | ||
1866 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); | 1879 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); |
1867 | dupe.m_isBackedUp = false; | 1880 | dupe.m_isBackedUp = false; |
1868 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); | 1881 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); |
@@ -1926,13 +1939,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1926 | pbs, | 1939 | pbs, |
1927 | newPart.AbsolutePosition, | 1940 | newPart.AbsolutePosition, |
1928 | newPart.Scale, | 1941 | newPart.Scale, |
1929 | newPart.RotationOffset, | 1942 | //newPart.RotationOffset, |
1943 | newPart.GetWorldRotation(), | ||
1930 | part.PhysActor.IsPhysical, | 1944 | part.PhysActor.IsPhysical, |
1931 | newPart.LocalId); | 1945 | newPart.LocalId); |
1932 | 1946 | ||
1933 | newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); | 1947 | newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); |
1934 | } | 1948 | } |
1935 | } | 1949 | } |
1950 | if (dupe.m_rootPart.PhysActor != null && userExposed) | ||
1951 | dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building | ||
1936 | 1952 | ||
1937 | if (userExposed) | 1953 | if (userExposed) |
1938 | { | 1954 | { |
@@ -1943,6 +1959,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1943 | ScheduleGroupForFullUpdate(); | 1959 | ScheduleGroupForFullUpdate(); |
1944 | } | 1960 | } |
1945 | 1961 | ||
1962 | m_dupeInProgress = false; | ||
1946 | return dupe; | 1963 | return dupe; |
1947 | } | 1964 | } |
1948 | 1965 | ||
@@ -2950,12 +2967,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
2950 | } | 2967 | } |
2951 | } | 2968 | } |
2952 | 2969 | ||
2970 | /* | ||
2953 | RootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); | 2971 | RootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); |
2954 | for (int i = 0; i < parts.Length; i++) | 2972 | for (int i = 0; i < parts.Length; i++) |
2955 | { | 2973 | { |
2956 | if (parts[i] != RootPart) | 2974 | if (parts[i] != RootPart) |
2957 | parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); | 2975 | parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); |
2958 | } | 2976 | } |
2977 | */ | ||
2978 | if (parts.Length > 1) | ||
2979 | { | ||
2980 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); | ||
2981 | |||
2982 | for (int i = 0; i < parts.Length; i++) | ||
2983 | { | ||
2984 | |||
2985 | if (parts[i].UUID != m_rootPart.UUID) | ||
2986 | parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); | ||
2987 | } | ||
2988 | |||
2989 | if (m_rootPart.PhysActor != null) | ||
2990 | m_rootPart.PhysActor.Building = false; | ||
2991 | } | ||
2992 | else | ||
2993 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, false); | ||
2994 | |||
2959 | } | 2995 | } |
2960 | } | 2996 | } |
2961 | 2997 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d6d04b2..de1dd8c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -310,6 +310,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
310 | private UUID m_collisionSound; | 310 | private UUID m_collisionSound; |
311 | private float m_collisionSoundVolume; | 311 | private float m_collisionSoundVolume; |
312 | 312 | ||
313 | |||
314 | private SOPVehicle m_vehicle = null; | ||
315 | |||
313 | #endregion Fields | 316 | #endregion Fields |
314 | 317 | ||
315 | // ~SceneObjectPart() | 318 | // ~SceneObjectPart() |
@@ -1506,7 +1509,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1506 | /// </summary> | 1509 | /// </summary> |
1507 | /// <param name="rootObjectFlags"></param> | 1510 | /// <param name="rootObjectFlags"></param> |
1508 | /// <param name="VolumeDetectActive"></param> | 1511 | /// <param name="VolumeDetectActive"></param> |
1509 | public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive) | 1512 | // public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive) |
1513 | public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive, bool building) | ||
1510 | { | 1514 | { |
1511 | if (!ParentGroup.Scene.CollidablePrims) | 1515 | if (!ParentGroup.Scene.CollidablePrims) |
1512 | return; | 1516 | return; |
@@ -1542,7 +1546,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1542 | Shape, | 1546 | Shape, |
1543 | AbsolutePosition, | 1547 | AbsolutePosition, |
1544 | Scale, | 1548 | Scale, |
1545 | RotationOffset, | 1549 | // RotationOffset, |
1550 | GetWorldRotation(), // physics wants world rotation | ||
1546 | RigidBody, | 1551 | RigidBody, |
1547 | m_localId); | 1552 | m_localId); |
1548 | } | 1553 | } |
@@ -1557,8 +1562,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1557 | { | 1562 | { |
1558 | PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info | 1563 | PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info |
1559 | PhysActor.SetMaterial(Material); | 1564 | PhysActor.SetMaterial(Material); |
1565 | |||
1566 | // if root part apply vehicle | ||
1567 | if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) | ||
1568 | m_vehicle.SetVehicle(PhysActor); | ||
1569 | |||
1560 | DoPhysicsPropertyUpdate(RigidBody, true); | 1570 | DoPhysicsPropertyUpdate(RigidBody, true); |
1561 | PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); | 1571 | PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); |
1572 | |||
1573 | if (!building) | ||
1574 | PhysActor.Building = false; | ||
1562 | } | 1575 | } |
1563 | } | 1576 | } |
1564 | } | 1577 | } |
@@ -1794,6 +1807,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1794 | if (!isNew) | 1807 | if (!isNew) |
1795 | ParentGroup.Scene.RemovePhysicalPrim(1); | 1808 | ParentGroup.Scene.RemovePhysicalPrim(1); |
1796 | 1809 | ||
1810 | Velocity = new Vector3(0, 0, 0); | ||
1811 | Acceleration = new Vector3(0, 0, 0); | ||
1812 | AngularVelocity = new Vector3(0, 0, 0); | ||
1813 | |||
1797 | PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; | 1814 | PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; |
1798 | PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; | 1815 | PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; |
1799 | PhysActor.delink(); | 1816 | PhysActor.delink(); |
@@ -3163,17 +3180,61 @@ namespace OpenSim.Region.Framework.Scenes | |||
3163 | } | 3180 | } |
3164 | } | 3181 | } |
3165 | 3182 | ||
3183 | |||
3184 | public int VehicleType | ||
3185 | { | ||
3186 | get | ||
3187 | { | ||
3188 | if (m_vehicle == null) | ||
3189 | return (int)Vehicle.TYPE_NONE; | ||
3190 | else | ||
3191 | return (int)m_vehicle.Type; | ||
3192 | } | ||
3193 | set | ||
3194 | { | ||
3195 | SetVehicleType(value); | ||
3196 | } | ||
3197 | } | ||
3198 | |||
3166 | public void SetVehicleType(int type) | 3199 | public void SetVehicleType(int type) |
3167 | { | 3200 | { |
3168 | if (PhysActor != null) | 3201 | m_vehicle = null; |
3202 | if (type == (int)Vehicle.TYPE_NONE) | ||
3203 | { | ||
3204 | if (_parentID ==0 && PhysActor != null) | ||
3205 | PhysActor.VehicleType = (int)Vehicle.TYPE_NONE; | ||
3206 | return; | ||
3207 | } | ||
3208 | m_vehicle = new SOPVehicle(); | ||
3209 | m_vehicle.ProcessTypeChange((Vehicle)type); | ||
3210 | { | ||
3211 | if (_parentID ==0 && PhysActor != null) | ||
3212 | PhysActor.VehicleType = type; | ||
3213 | return; | ||
3214 | } | ||
3215 | } | ||
3216 | |||
3217 | public void SetVehicleFlags(int param, bool remove) | ||
3218 | { | ||
3219 | if (m_vehicle == null) | ||
3220 | return; | ||
3221 | |||
3222 | m_vehicle.ProcessVehicleFlags(param, remove); | ||
3223 | |||
3224 | if (_parentID ==0 && PhysActor != null) | ||
3169 | { | 3225 | { |
3170 | PhysActor.VehicleType = type; | 3226 | PhysActor.VehicleFlags(param, remove); |
3171 | } | 3227 | } |
3172 | } | 3228 | } |
3173 | 3229 | ||
3174 | public void SetVehicleFloatParam(int param, float value) | 3230 | public void SetVehicleFloatParam(int param, float value) |
3175 | { | 3231 | { |
3176 | if (PhysActor != null) | 3232 | if (m_vehicle == null) |
3233 | return; | ||
3234 | |||
3235 | m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value); | ||
3236 | |||
3237 | if (_parentID == 0 && PhysActor != null) | ||
3177 | { | 3238 | { |
3178 | PhysActor.VehicleFloatParam(param, value); | 3239 | PhysActor.VehicleFloatParam(param, value); |
3179 | } | 3240 | } |
@@ -3181,7 +3242,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3181 | 3242 | ||
3182 | public void SetVehicleVectorParam(int param, Vector3 value) | 3243 | public void SetVehicleVectorParam(int param, Vector3 value) |
3183 | { | 3244 | { |
3184 | if (PhysActor != null) | 3245 | if (m_vehicle == null) |
3246 | return; | ||
3247 | |||
3248 | m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value); | ||
3249 | |||
3250 | if (_parentID == 0 && PhysActor != null) | ||
3185 | { | 3251 | { |
3186 | PhysActor.VehicleVectorParam(param, value); | 3252 | PhysActor.VehicleVectorParam(param, value); |
3187 | } | 3253 | } |
@@ -3189,7 +3255,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3189 | 3255 | ||
3190 | public void SetVehicleRotationParam(int param, Quaternion rotation) | 3256 | public void SetVehicleRotationParam(int param, Quaternion rotation) |
3191 | { | 3257 | { |
3192 | if (PhysActor != null) | 3258 | if (m_vehicle == null) |
3259 | return; | ||
3260 | |||
3261 | m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); | ||
3262 | |||
3263 | if (_parentID == 0 && PhysActor != null) | ||
3193 | { | 3264 | { |
3194 | PhysActor.VehicleRotationParam(param, rotation); | 3265 | PhysActor.VehicleRotationParam(param, rotation); |
3195 | } | 3266 | } |
@@ -3376,13 +3447,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3376 | hasProfileCut = hasDimple; // is it the same thing? | 3447 | hasProfileCut = hasDimple; // is it the same thing? |
3377 | } | 3448 | } |
3378 | 3449 | ||
3379 | public void SetVehicleFlags(int param, bool remove) | ||
3380 | { | ||
3381 | if (PhysActor != null) | ||
3382 | { | ||
3383 | PhysActor.VehicleFlags(param, remove); | ||
3384 | } | ||
3385 | } | ||
3386 | 3450 | ||
3387 | public void SetGroup(UUID groupID, IClientAPI client) | 3451 | public void SetGroup(UUID groupID, IClientAPI client) |
3388 | { | 3452 | { |
@@ -4270,7 +4334,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4270 | /// <param name="SetTemporary"></param> | 4334 | /// <param name="SetTemporary"></param> |
4271 | /// <param name="SetPhantom"></param> | 4335 | /// <param name="SetPhantom"></param> |
4272 | /// <param name="SetVD"></param> | 4336 | /// <param name="SetVD"></param> |
4273 | public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD) | 4337 | // public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD) |
4338 | public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD, bool building) | ||
4274 | { | 4339 | { |
4275 | bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); | 4340 | bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); |
4276 | bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); | 4341 | bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); |
@@ -4288,6 +4353,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4288 | // that... | 4353 | // that... |
4289 | // ... if VD is changed, all others are not. | 4354 | // ... if VD is changed, all others are not. |
4290 | // ... if one of the others is changed, VD is not. | 4355 | // ... if one of the others is changed, VD is not. |
4356 | // do this first | ||
4357 | if (building && PhysActor != null && PhysActor.Building != building) | ||
4358 | PhysActor.Building = building; | ||
4291 | if (SetVD) // VD is active, special logic applies | 4359 | if (SetVD) // VD is active, special logic applies |
4292 | { | 4360 | { |
4293 | // State machine logic for VolumeDetect | 4361 | // State machine logic for VolumeDetect |
@@ -4369,11 +4437,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4369 | Shape, | 4437 | Shape, |
4370 | AbsolutePosition, | 4438 | AbsolutePosition, |
4371 | Scale, | 4439 | Scale, |
4372 | RotationOffset, | 4440 | // RotationOffset, |
4441 | GetWorldRotation(), //physics wants world rotation like all other functions send | ||
4373 | UsePhysics, | 4442 | UsePhysics, |
4374 | m_localId); | 4443 | m_localId); |
4375 | 4444 | ||
4376 | PhysActor.SetMaterial(Material); | 4445 | PhysActor.SetMaterial(Material); |
4446 | |||
4447 | // if root part apply vehicle | ||
4448 | if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) | ||
4449 | m_vehicle.SetVehicle(PhysActor); | ||
4450 | |||
4377 | DoPhysicsPropertyUpdate(UsePhysics, true); | 4451 | DoPhysicsPropertyUpdate(UsePhysics, true); |
4378 | 4452 | ||
4379 | if (!ParentGroup.IsDeleted) | 4453 | if (!ParentGroup.IsDeleted) |
@@ -4449,6 +4523,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4449 | } | 4523 | } |
4450 | // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); | 4524 | // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); |
4451 | 4525 | ||
4526 | // and last in case we have a new actor and not building | ||
4527 | if (PhysActor != null && PhysActor.Building != building) | ||
4528 | PhysActor.Building = building; | ||
4452 | if (ParentGroup != null) | 4529 | if (ParentGroup != null) |
4453 | { | 4530 | { |
4454 | ParentGroup.HasGroupChanged = true; | 4531 | ParentGroup.HasGroupChanged = true; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 429fc06..8a42616 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1843,8 +1843,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1843 | // m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name); | 1843 | // m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name); |
1844 | 1844 | ||
1845 | SitGround = false; | 1845 | SitGround = false; |
1846 | |||
1847 | /* move this down so avatar gets physical in the new position and not where it is siting | ||
1846 | if (PhysicsActor == null) | 1848 | if (PhysicsActor == null) |
1847 | AddToPhysicalScene(false); | 1849 | AddToPhysicalScene(false); |
1850 | */ | ||
1848 | 1851 | ||
1849 | if (ParentID != 0) | 1852 | if (ParentID != 0) |
1850 | { | 1853 | { |
@@ -1879,6 +1882,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1879 | ParentPosition = Vector3.Zero; | 1882 | ParentPosition = Vector3.Zero; |
1880 | 1883 | ||
1881 | ParentID = 0; | 1884 | ParentID = 0; |
1885 | |||
1886 | if (PhysicsActor == null) | ||
1887 | AddToPhysicalScene(false); | ||
1888 | |||
1882 | SendAvatarDataToAllAgents(); | 1889 | SendAvatarDataToAllAgents(); |
1883 | m_requestedSitTargetID = 0; | 1890 | m_requestedSitTargetID = 0; |
1884 | 1891 | ||
@@ -1886,6 +1893,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1886 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | 1893 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); |
1887 | } | 1894 | } |
1888 | 1895 | ||
1896 | else if (PhysicsActor == null) | ||
1897 | AddToPhysicalScene(false); | ||
1898 | |||
1889 | Animator.TrySetMovementAnimation("STAND"); | 1899 | Animator.TrySetMovementAnimation("STAND"); |
1890 | } | 1900 | } |
1891 | 1901 | ||