diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SOGVehicle.cs | 336 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs | 62 | ||||
-rw-r--r-- | OpenSim/Region/Physics/ChOdePlugin/OdeUtils.cs | 294 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/VehicleConstants.cs | 45 |
6 files changed, 522 insertions, 222 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SOGVehicle.cs b/OpenSim/Region/Framework/Scenes/SOGVehicle.cs index b7c93e5..470f403 100644 --- a/OpenSim/Region/Framework/Scenes/SOGVehicle.cs +++ b/OpenSim/Region/Framework/Scenes/SOGVehicle.cs | |||
@@ -37,9 +37,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
37 | { | 37 | { |
38 | public Vehicle Type | 38 | public Vehicle Type |
39 | { | 39 | { |
40 | get { return m_type; } | 40 | get { return vd.m_type; } |
41 | } | 41 | } |
42 | 42 | ||
43 | public VehicleData vd; | ||
44 | /* | ||
43 | private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind | 45 | private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind |
44 | private VehicleFlag m_flags = (VehicleFlag)0; | 46 | private VehicleFlag m_flags = (VehicleFlag)0; |
45 | 47 | ||
@@ -78,7 +80,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
78 | private float m_verticalAttractionTimescale = 1000f; // Timescale > 300 means no vert attractor. | 80 | private float m_verticalAttractionTimescale = 1000f; // Timescale > 300 means no vert attractor. |
79 | 81 | ||
80 | // Axis | 82 | // Axis |
81 | public Quaternion m_referenceFrame = Quaternion.Identity; | 83 | public Quaternion m_referenceFrame = Quaternion.Identity; |
84 | */ | ||
85 | public SOGVehicle() | ||
86 | { | ||
87 | vd = new VehicleData(); | ||
88 | ProcessTypeChange(Vehicle.TYPE_NONE); // is needed? | ||
89 | } | ||
82 | 90 | ||
83 | public void ProcessFloatVehicleParam(Vehicle pParam, float pValue) | 91 | public void ProcessFloatVehicleParam(Vehicle pParam, float pValue) |
84 | { | 92 | { |
@@ -89,109 +97,109 @@ namespace OpenSim.Region.Framework.Scenes | |||
89 | case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY: | 97 | case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY: |
90 | if (pValue < 0f) pValue = 0f; | 98 | if (pValue < 0f) pValue = 0f; |
91 | if (pValue > 1f) pValue = 1f; | 99 | if (pValue > 1f) pValue = 1f; |
92 | m_angularDeflectionEfficiency = pValue; | 100 | vd.m_angularDeflectionEfficiency = pValue; |
93 | break; | 101 | break; |
94 | case Vehicle.ANGULAR_DEFLECTION_TIMESCALE: | 102 | case Vehicle.ANGULAR_DEFLECTION_TIMESCALE: |
95 | if (pValue < timestep) pValue = timestep; | 103 | if (pValue < timestep) pValue = timestep; |
96 | m_angularDeflectionTimescale = pValue; | 104 | vd.m_angularDeflectionTimescale = pValue; |
97 | break; | 105 | break; |
98 | case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE: | 106 | case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE: |
99 | if (pValue < timestep) pValue = timestep; | 107 | if (pValue < timestep) pValue = timestep; |
100 | else if (pValue > 120) pValue = 120; | 108 | else if (pValue > 120) pValue = 120; |
101 | m_angularMotorDecayTimescale = pValue; | 109 | vd.m_angularMotorDecayTimescale = pValue; |
102 | break; | 110 | break; |
103 | case Vehicle.ANGULAR_MOTOR_TIMESCALE: | 111 | case Vehicle.ANGULAR_MOTOR_TIMESCALE: |
104 | if (pValue < timestep) pValue = timestep; | 112 | if (pValue < timestep) pValue = timestep; |
105 | m_angularMotorTimescale = pValue; | 113 | vd.m_angularMotorTimescale = pValue; |
106 | break; | 114 | break; |
107 | case Vehicle.BANKING_EFFICIENCY: | 115 | case Vehicle.BANKING_EFFICIENCY: |
108 | if (pValue < -1f) pValue = -1f; | 116 | if (pValue < -1f) pValue = -1f; |
109 | if (pValue > 1f) pValue = 1f; | 117 | if (pValue > 1f) pValue = 1f; |
110 | m_bankingEfficiency = pValue; | 118 | vd.m_bankingEfficiency = pValue; |
111 | break; | 119 | break; |
112 | case Vehicle.BANKING_MIX: | 120 | case Vehicle.BANKING_MIX: |
113 | if (pValue < 0f) pValue = 0f; | 121 | if (pValue < 0f) pValue = 0f; |
114 | if (pValue > 1f) pValue = 1f; | 122 | if (pValue > 1f) pValue = 1f; |
115 | m_bankingMix = pValue; | 123 | vd.m_bankingMix = pValue; |
116 | break; | 124 | break; |
117 | case Vehicle.BANKING_TIMESCALE: | 125 | case Vehicle.BANKING_TIMESCALE: |
118 | if (pValue < timestep) pValue = timestep; | 126 | if (pValue < timestep) pValue = timestep; |
119 | m_bankingTimescale = pValue; | 127 | vd.m_bankingTimescale = pValue; |
120 | break; | 128 | break; |
121 | case Vehicle.BUOYANCY: | 129 | case Vehicle.BUOYANCY: |
122 | if (pValue < -1f) pValue = -1f; | 130 | if (pValue < -1f) pValue = -1f; |
123 | if (pValue > 1f) pValue = 1f; | 131 | if (pValue > 1f) pValue = 1f; |
124 | m_VehicleBuoyancy = pValue; | 132 | vd.m_VehicleBuoyancy = pValue; |
125 | break; | 133 | break; |
126 | case Vehicle.HOVER_EFFICIENCY: | 134 | case Vehicle.HOVER_EFFICIENCY: |
127 | if (pValue < 0f) pValue = 0f; | 135 | if (pValue < 0f) pValue = 0f; |
128 | if (pValue > 1f) pValue = 1f; | 136 | if (pValue > 1f) pValue = 1f; |
129 | m_VhoverEfficiency = pValue; | 137 | vd.m_VhoverEfficiency = pValue; |
130 | break; | 138 | break; |
131 | case Vehicle.HOVER_HEIGHT: | 139 | case Vehicle.HOVER_HEIGHT: |
132 | m_VhoverHeight = pValue; | 140 | vd.m_VhoverHeight = pValue; |
133 | break; | 141 | break; |
134 | case Vehicle.HOVER_TIMESCALE: | 142 | case Vehicle.HOVER_TIMESCALE: |
135 | if (pValue < timestep) pValue = timestep; | 143 | if (pValue < timestep) pValue = timestep; |
136 | m_VhoverTimescale = pValue; | 144 | vd.m_VhoverTimescale = pValue; |
137 | break; | 145 | break; |
138 | case Vehicle.LINEAR_DEFLECTION_EFFICIENCY: | 146 | case Vehicle.LINEAR_DEFLECTION_EFFICIENCY: |
139 | if (pValue < 0f) pValue = 0f; | 147 | if (pValue < 0f) pValue = 0f; |
140 | if (pValue > 1f) pValue = 1f; | 148 | if (pValue > 1f) pValue = 1f; |
141 | m_linearDeflectionEfficiency = pValue; | 149 | vd.m_linearDeflectionEfficiency = pValue; |
142 | break; | 150 | break; |
143 | case Vehicle.LINEAR_DEFLECTION_TIMESCALE: | 151 | case Vehicle.LINEAR_DEFLECTION_TIMESCALE: |
144 | if (pValue < timestep) pValue = timestep; | 152 | if (pValue < timestep) pValue = timestep; |
145 | m_linearDeflectionTimescale = pValue; | 153 | vd.m_linearDeflectionTimescale = pValue; |
146 | break; | 154 | break; |
147 | case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE: | 155 | case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE: |
148 | // if (pValue < timestep) pValue = timestep; | 156 | // if (pValue < timestep) pValue = timestep; |
149 | // try to make impulses to work a bit better | 157 | // try to make impulses to work a bit better |
150 | if (pValue < timestep) pValue = timestep; | 158 | if (pValue < timestep) pValue = timestep; |
151 | else if (pValue > 120) pValue = 120; | 159 | else if (pValue > 120) pValue = 120; |
152 | m_linearMotorDecayTimescale = pValue; | 160 | vd.m_linearMotorDecayTimescale = pValue; |
153 | break; | 161 | break; |
154 | case Vehicle.LINEAR_MOTOR_TIMESCALE: | 162 | case Vehicle.LINEAR_MOTOR_TIMESCALE: |
155 | if (pValue < timestep) pValue = timestep; | 163 | if (pValue < timestep) pValue = timestep; |
156 | m_linearMotorTimescale = pValue; | 164 | vd.m_linearMotorTimescale = pValue; |
157 | break; | 165 | break; |
158 | case Vehicle.VERTICAL_ATTRACTION_EFFICIENCY: | 166 | case Vehicle.VERTICAL_ATTRACTION_EFFICIENCY: |
159 | if (pValue < 0f) pValue = 0f; | 167 | if (pValue < 0f) pValue = 0f; |
160 | if (pValue > 1f) pValue = 1f; | 168 | if (pValue > 1f) pValue = 1f; |
161 | m_verticalAttractionEfficiency = pValue; | 169 | vd.m_verticalAttractionEfficiency = pValue; |
162 | break; | 170 | break; |
163 | case Vehicle.VERTICAL_ATTRACTION_TIMESCALE: | 171 | case Vehicle.VERTICAL_ATTRACTION_TIMESCALE: |
164 | if (pValue < timestep) pValue = timestep; | 172 | if (pValue < timestep) pValue = timestep; |
165 | m_verticalAttractionTimescale = pValue; | 173 | vd.m_verticalAttractionTimescale = pValue; |
166 | break; | 174 | break; |
167 | 175 | ||
168 | // These are vector properties but the engine lets you use a single float value to | 176 | // These are vector properties but the engine lets you use a single float value to |
169 | // set all of the components to the same value | 177 | // set all of the components to the same value |
170 | case Vehicle.ANGULAR_FRICTION_TIMESCALE: | 178 | case Vehicle.ANGULAR_FRICTION_TIMESCALE: |
171 | if (pValue < timestep) pValue = timestep; | 179 | if (pValue < timestep) pValue = timestep; |
172 | m_angularFrictionTimescale = new Vector3(pValue, pValue, pValue); | 180 | vd.m_angularFrictionTimescale = new Vector3(pValue, pValue, pValue); |
173 | break; | 181 | break; |
174 | case Vehicle.ANGULAR_MOTOR_DIRECTION: | 182 | case Vehicle.ANGULAR_MOTOR_DIRECTION: |
175 | m_angularMotorDirection = new Vector3(pValue, pValue, pValue); | 183 | vd.m_angularMotorDirection = new Vector3(pValue, pValue, pValue); |
176 | len = m_angularMotorDirection.Length(); | 184 | len = vd.m_angularMotorDirection.Length(); |
177 | if (len > 12.566f) | 185 | if (len > 12.566f) |
178 | m_angularMotorDirection *= (12.566f / len); | 186 | vd.m_angularMotorDirection *= (12.566f / len); |
179 | break; | 187 | break; |
180 | case Vehicle.LINEAR_FRICTION_TIMESCALE: | 188 | case Vehicle.LINEAR_FRICTION_TIMESCALE: |
181 | if (pValue < timestep) pValue = timestep; | 189 | if (pValue < timestep) pValue = timestep; |
182 | m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue); | 190 | vd.m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue); |
183 | break; | 191 | break; |
184 | case Vehicle.LINEAR_MOTOR_DIRECTION: | 192 | case Vehicle.LINEAR_MOTOR_DIRECTION: |
185 | m_linearMotorDirection = new Vector3(pValue, pValue, pValue); | 193 | vd.m_linearMotorDirection = new Vector3(pValue, pValue, pValue); |
186 | len = m_linearMotorDirection.Length(); | 194 | len = vd.m_linearMotorDirection.Length(); |
187 | if (len > 30.0f) | 195 | if (len > 30.0f) |
188 | m_linearMotorDirection *= (30.0f / len); | 196 | vd.m_linearMotorDirection *= (30.0f / len); |
189 | break; | 197 | break; |
190 | case Vehicle.LINEAR_MOTOR_OFFSET: | 198 | case Vehicle.LINEAR_MOTOR_OFFSET: |
191 | m_linearMotorOffset = new Vector3(pValue, pValue, pValue); | 199 | vd.m_linearMotorOffset = new Vector3(pValue, pValue, pValue); |
192 | len = m_linearMotorOffset.Length(); | 200 | len = vd.m_linearMotorOffset.Length(); |
193 | if (len > 100.0f) | 201 | if (len > 100.0f) |
194 | m_linearMotorOffset *= (100.0f / len); | 202 | vd.m_linearMotorOffset *= (100.0f / len); |
195 | break; | 203 | break; |
196 | } | 204 | } |
197 | }//end ProcessFloatVehicleParam | 205 | }//end ProcessFloatVehicleParam |
@@ -207,32 +215,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
207 | if (pValue.Y < timestep) pValue.Y = timestep; | 215 | if (pValue.Y < timestep) pValue.Y = timestep; |
208 | if (pValue.Z < timestep) pValue.Z = timestep; | 216 | if (pValue.Z < timestep) pValue.Z = timestep; |
209 | 217 | ||
210 | m_angularFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); | 218 | vd.m_angularFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); |
211 | break; | 219 | break; |
212 | case Vehicle.ANGULAR_MOTOR_DIRECTION: | 220 | case Vehicle.ANGULAR_MOTOR_DIRECTION: |
213 | m_angularMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); | 221 | vd.m_angularMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); |
214 | // Limit requested angular speed to 2 rps= 4 pi rads/sec | 222 | // Limit requested angular speed to 2 rps= 4 pi rads/sec |
215 | len = m_angularMotorDirection.Length(); | 223 | len = vd.m_angularMotorDirection.Length(); |
216 | if (len > 12.566f) | 224 | if (len > 12.566f) |
217 | m_angularMotorDirection *= (12.566f / len); | 225 | vd.m_angularMotorDirection *= (12.566f / len); |
218 | break; | 226 | break; |
219 | case Vehicle.LINEAR_FRICTION_TIMESCALE: | 227 | case Vehicle.LINEAR_FRICTION_TIMESCALE: |
220 | if (pValue.X < timestep) pValue.X = timestep; | 228 | if (pValue.X < timestep) pValue.X = timestep; |
221 | if (pValue.Y < timestep) pValue.Y = timestep; | 229 | if (pValue.Y < timestep) pValue.Y = timestep; |
222 | if (pValue.Z < timestep) pValue.Z = timestep; | 230 | if (pValue.Z < timestep) pValue.Z = timestep; |
223 | m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); | 231 | vd.m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); |
224 | break; | 232 | break; |
225 | case Vehicle.LINEAR_MOTOR_DIRECTION: | 233 | case Vehicle.LINEAR_MOTOR_DIRECTION: |
226 | m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); | 234 | vd.m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); |
227 | len = m_linearMotorDirection.Length(); | 235 | len = vd.m_linearMotorDirection.Length(); |
228 | if (len > 30.0f) | 236 | if (len > 30.0f) |
229 | m_linearMotorDirection *= (30.0f / len); | 237 | vd.m_linearMotorDirection *= (30.0f / len); |
230 | break; | 238 | break; |
231 | case Vehicle.LINEAR_MOTOR_OFFSET: | 239 | case Vehicle.LINEAR_MOTOR_OFFSET: |
232 | m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z); | 240 | vd.m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z); |
233 | len = m_linearMotorOffset.Length(); | 241 | len = vd.m_linearMotorOffset.Length(); |
234 | if (len > 100.0f) | 242 | if (len > 100.0f) |
235 | m_linearMotorOffset *= (100.0f / len); | 243 | vd.m_linearMotorOffset *= (100.0f / len); |
236 | break; | 244 | break; |
237 | } | 245 | } |
238 | }//end ProcessVectorVehicleParam | 246 | }//end ProcessVectorVehicleParam |
@@ -242,7 +250,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
242 | switch (pParam) | 250 | switch (pParam) |
243 | { | 251 | { |
244 | case Vehicle.REFERENCE_FRAME: | 252 | case Vehicle.REFERENCE_FRAME: |
245 | m_referenceFrame = Quaternion.Inverse(pValue); | 253 | vd.m_referenceFrame = Quaternion.Inverse(pValue); |
246 | break; | 254 | break; |
247 | } | 255 | } |
248 | }//end ProcessRotationVehicleParam | 256 | }//end ProcessRotationVehicleParam |
@@ -251,169 +259,169 @@ namespace OpenSim.Region.Framework.Scenes | |||
251 | { | 259 | { |
252 | if (remove) | 260 | if (remove) |
253 | { | 261 | { |
254 | m_flags &= ~((VehicleFlag)pParam); | 262 | vd.m_flags &= ~((VehicleFlag)pParam); |
255 | } | 263 | } |
256 | else | 264 | else |
257 | { | 265 | { |
258 | m_flags |= (VehicleFlag)pParam; | 266 | vd.m_flags |= (VehicleFlag)pParam; |
259 | } | 267 | } |
260 | }//end ProcessVehicleFlags | 268 | }//end ProcessVehicleFlags |
261 | 269 | ||
262 | public void ProcessTypeChange(Vehicle pType) | 270 | public void ProcessTypeChange(Vehicle pType) |
263 | { | 271 | { |
264 | m_linearMotorDirection = Vector3.Zero; | 272 | vd.m_linearMotorDirection = Vector3.Zero; |
265 | m_angularMotorDirection = Vector3.Zero; | 273 | vd.m_angularMotorDirection = Vector3.Zero; |
266 | 274 | ||
267 | m_linearMotorOffset = Vector3.Zero; | 275 | vd.m_linearMotorOffset = Vector3.Zero; |
268 | 276 | ||
269 | m_referenceFrame = Quaternion.Identity; | 277 | vd.m_referenceFrame = Quaternion.Identity; |
270 | 278 | ||
271 | // Set Defaults For Type | 279 | // Set Defaults For Type |
272 | m_type = pType; | 280 | vd.m_type = pType; |
273 | switch (pType) | 281 | switch (pType) |
274 | { | 282 | { |
275 | case Vehicle.TYPE_NONE: // none sense this will never exist | 283 | case Vehicle.TYPE_NONE: // none sense this will never exist |
276 | m_linearFrictionTimescale = new Vector3(1000, 1000, 1000); | 284 | vd.m_linearFrictionTimescale = new Vector3(1000, 1000, 1000); |
277 | m_angularFrictionTimescale = new Vector3(1000, 1000, 1000); | 285 | vd.m_angularFrictionTimescale = new Vector3(1000, 1000, 1000); |
278 | m_linearMotorTimescale = 1000; | 286 | vd.m_linearMotorTimescale = 1000; |
279 | m_linearMotorDecayTimescale = 120; | 287 | vd.m_linearMotorDecayTimescale = 120; |
280 | m_angularMotorTimescale = 1000; | 288 | vd.m_angularMotorTimescale = 1000; |
281 | m_angularMotorDecayTimescale = 1000; | 289 | vd.m_angularMotorDecayTimescale = 1000; |
282 | m_VhoverHeight = 0; | 290 | vd.m_VhoverHeight = 0; |
283 | m_VhoverTimescale = 1000; | 291 | vd.m_VhoverTimescale = 1000; |
284 | m_VehicleBuoyancy = 0; | 292 | vd.m_VehicleBuoyancy = 0; |
285 | m_flags = (VehicleFlag)0; | 293 | vd.m_flags = (VehicleFlag)0; |
286 | break; | 294 | break; |
287 | 295 | ||
288 | case Vehicle.TYPE_SLED: | 296 | case Vehicle.TYPE_SLED: |
289 | m_linearFrictionTimescale = new Vector3(30, 1, 1000); | 297 | vd.m_linearFrictionTimescale = new Vector3(30, 1, 1000); |
290 | m_angularFrictionTimescale = new Vector3(1000, 1000, 1000); | 298 | vd.m_angularFrictionTimescale = new Vector3(1000, 1000, 1000); |
291 | m_linearMotorTimescale = 1000; | 299 | vd.m_linearMotorTimescale = 1000; |
292 | m_linearMotorDecayTimescale = 120; | 300 | vd.m_linearMotorDecayTimescale = 120; |
293 | m_angularMotorTimescale = 1000; | 301 | vd.m_angularMotorTimescale = 1000; |
294 | m_angularMotorDecayTimescale = 120; | 302 | vd.m_angularMotorDecayTimescale = 120; |
295 | m_VhoverHeight = 0; | 303 | vd.m_VhoverHeight = 0; |
296 | m_VhoverEfficiency = 1; | 304 | vd.m_VhoverEfficiency = 1; |
297 | m_VhoverTimescale = 10; | 305 | vd.m_VhoverTimescale = 10; |
298 | m_VehicleBuoyancy = 0; | 306 | vd.m_VehicleBuoyancy = 0; |
299 | m_linearDeflectionEfficiency = 1; | 307 | vd.m_linearDeflectionEfficiency = 1; |
300 | m_linearDeflectionTimescale = 1; | 308 | vd.m_linearDeflectionTimescale = 1; |
301 | m_angularDeflectionEfficiency = 0; | 309 | vd.m_angularDeflectionEfficiency = 0; |
302 | m_angularDeflectionTimescale = 1000; | 310 | vd.m_angularDeflectionTimescale = 1000; |
303 | m_bankingEfficiency = 0; | 311 | vd.m_bankingEfficiency = 0; |
304 | m_bankingMix = 1; | 312 | vd.m_bankingMix = 1; |
305 | m_bankingTimescale = 10; | 313 | vd.m_bankingTimescale = 10; |
306 | m_flags &= | 314 | vd.m_flags &= |
307 | ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | | 315 | ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | |
308 | VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY); | 316 | VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY); |
309 | m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP); | 317 | vd.m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP); |
310 | break; | 318 | break; |
311 | case Vehicle.TYPE_CAR: | 319 | case Vehicle.TYPE_CAR: |
312 | m_linearFrictionTimescale = new Vector3(100, 2, 1000); | 320 | vd.m_linearFrictionTimescale = new Vector3(100, 2, 1000); |
313 | m_angularFrictionTimescale = new Vector3(1000, 1000, 1000); | 321 | vd.m_angularFrictionTimescale = new Vector3(1000, 1000, 1000); |
314 | m_linearMotorTimescale = 1; | 322 | vd.m_linearMotorTimescale = 1; |
315 | m_linearMotorDecayTimescale = 60; | 323 | vd.m_linearMotorDecayTimescale = 60; |
316 | m_angularMotorTimescale = 1; | 324 | vd.m_angularMotorTimescale = 1; |
317 | m_angularMotorDecayTimescale = 0.8f; | 325 | vd.m_angularMotorDecayTimescale = 0.8f; |
318 | m_VhoverHeight = 0; | 326 | vd.m_VhoverHeight = 0; |
319 | m_VhoverEfficiency = 0; | 327 | vd.m_VhoverEfficiency = 0; |
320 | m_VhoverTimescale = 1000; | 328 | vd.m_VhoverTimescale = 1000; |
321 | m_VehicleBuoyancy = 0; | 329 | vd.m_VehicleBuoyancy = 0; |
322 | m_linearDeflectionEfficiency = 1; | 330 | vd.m_linearDeflectionEfficiency = 1; |
323 | m_linearDeflectionTimescale = 2; | 331 | vd.m_linearDeflectionTimescale = 2; |
324 | m_angularDeflectionEfficiency = 0; | 332 | vd.m_angularDeflectionEfficiency = 0; |
325 | m_angularDeflectionTimescale = 10; | 333 | vd.m_angularDeflectionTimescale = 10; |
326 | m_verticalAttractionEfficiency = 1f; | 334 | vd.m_verticalAttractionEfficiency = 1f; |
327 | m_verticalAttractionTimescale = 10f; | 335 | vd.m_verticalAttractionTimescale = 10f; |
328 | m_bankingEfficiency = -0.2f; | 336 | vd.m_bankingEfficiency = -0.2f; |
329 | m_bankingMix = 1; | 337 | vd.m_bankingMix = 1; |
330 | m_bankingTimescale = 1; | 338 | vd.m_bankingTimescale = 1; |
331 | m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT); | 339 | vd.m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT); |
332 | m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | | 340 | vd.m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | |
333 | VehicleFlag.LIMIT_MOTOR_UP | VehicleFlag.HOVER_UP_ONLY); | 341 | VehicleFlag.LIMIT_MOTOR_UP | VehicleFlag.HOVER_UP_ONLY); |
334 | break; | 342 | break; |
335 | case Vehicle.TYPE_BOAT: | 343 | case Vehicle.TYPE_BOAT: |
336 | m_linearFrictionTimescale = new Vector3(10, 3, 2); | 344 | vd.m_linearFrictionTimescale = new Vector3(10, 3, 2); |
337 | m_angularFrictionTimescale = new Vector3(10, 10, 10); | 345 | vd.m_angularFrictionTimescale = new Vector3(10, 10, 10); |
338 | m_linearMotorTimescale = 5; | 346 | vd.m_linearMotorTimescale = 5; |
339 | m_linearMotorDecayTimescale = 60; | 347 | vd.m_linearMotorDecayTimescale = 60; |
340 | m_angularMotorTimescale = 4; | 348 | vd.m_angularMotorTimescale = 4; |
341 | m_angularMotorDecayTimescale = 4; | 349 | vd.m_angularMotorDecayTimescale = 4; |
342 | m_VhoverHeight = 0; | 350 | vd.m_VhoverHeight = 0; |
343 | m_VhoverEfficiency = 0.5f; | 351 | vd.m_VhoverEfficiency = 0.5f; |
344 | m_VhoverTimescale = 2; | 352 | vd.m_VhoverTimescale = 2; |
345 | m_VehicleBuoyancy = 1; | 353 | vd.m_VehicleBuoyancy = 1; |
346 | m_linearDeflectionEfficiency = 0.5f; | 354 | vd.m_linearDeflectionEfficiency = 0.5f; |
347 | m_linearDeflectionTimescale = 3; | 355 | vd.m_linearDeflectionTimescale = 3; |
348 | m_angularDeflectionEfficiency = 0.5f; | 356 | vd.m_angularDeflectionEfficiency = 0.5f; |
349 | m_angularDeflectionTimescale = 5; | 357 | vd.m_angularDeflectionTimescale = 5; |
350 | m_verticalAttractionEfficiency = 0.5f; | 358 | vd.m_verticalAttractionEfficiency = 0.5f; |
351 | m_verticalAttractionTimescale = 5f; | 359 | vd.m_verticalAttractionTimescale = 5f; |
352 | m_bankingEfficiency = -0.3f; | 360 | vd.m_bankingEfficiency = -0.3f; |
353 | m_bankingMix = 0.8f; | 361 | vd.m_bankingMix = 0.8f; |
354 | m_bankingTimescale = 1; | 362 | vd.m_bankingTimescale = 1; |
355 | m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY | | 363 | vd.m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY | |
356 | VehicleFlag.HOVER_GLOBAL_HEIGHT | | 364 | VehicleFlag.HOVER_GLOBAL_HEIGHT | |
357 | VehicleFlag.HOVER_UP_ONLY | | 365 | VehicleFlag.HOVER_UP_ONLY | |
358 | VehicleFlag.LIMIT_ROLL_ONLY); | 366 | VehicleFlag.LIMIT_ROLL_ONLY); |
359 | m_flags |= (VehicleFlag.NO_DEFLECTION_UP | | 367 | vd.m_flags |= (VehicleFlag.NO_DEFLECTION_UP | |
360 | VehicleFlag.LIMIT_MOTOR_UP | | 368 | VehicleFlag.LIMIT_MOTOR_UP | |
361 | VehicleFlag.HOVER_WATER_ONLY); | 369 | VehicleFlag.HOVER_WATER_ONLY); |
362 | break; | 370 | break; |
363 | case Vehicle.TYPE_AIRPLANE: | 371 | case Vehicle.TYPE_AIRPLANE: |
364 | m_linearFrictionTimescale = new Vector3(200, 10, 5); | 372 | vd.m_linearFrictionTimescale = new Vector3(200, 10, 5); |
365 | m_angularFrictionTimescale = new Vector3(20, 20, 20); | 373 | vd.m_angularFrictionTimescale = new Vector3(20, 20, 20); |
366 | m_linearMotorTimescale = 2; | 374 | vd.m_linearMotorTimescale = 2; |
367 | m_linearMotorDecayTimescale = 60; | 375 | vd.m_linearMotorDecayTimescale = 60; |
368 | m_angularMotorTimescale = 4; | 376 | vd.m_angularMotorTimescale = 4; |
369 | m_angularMotorDecayTimescale = 8; | 377 | vd.m_angularMotorDecayTimescale = 8; |
370 | m_VhoverHeight = 0; | 378 | vd.m_VhoverHeight = 0; |
371 | m_VhoverEfficiency = 0.5f; | 379 | vd.m_VhoverEfficiency = 0.5f; |
372 | m_VhoverTimescale = 1000; | 380 | vd.m_VhoverTimescale = 1000; |
373 | m_VehicleBuoyancy = 0; | 381 | vd.m_VehicleBuoyancy = 0; |
374 | m_linearDeflectionEfficiency = 0.5f; | 382 | vd.m_linearDeflectionEfficiency = 0.5f; |
375 | m_linearDeflectionTimescale = 0.5f; | 383 | vd.m_linearDeflectionTimescale = 0.5f; |
376 | m_angularDeflectionEfficiency = 1; | 384 | vd.m_angularDeflectionEfficiency = 1; |
377 | m_angularDeflectionTimescale = 2; | 385 | vd.m_angularDeflectionTimescale = 2; |
378 | m_verticalAttractionEfficiency = 0.9f; | 386 | vd.m_verticalAttractionEfficiency = 0.9f; |
379 | m_verticalAttractionTimescale = 2f; | 387 | vd.m_verticalAttractionTimescale = 2f; |
380 | m_bankingEfficiency = 1; | 388 | vd.m_bankingEfficiency = 1; |
381 | m_bankingMix = 0.7f; | 389 | vd.m_bankingMix = 0.7f; |
382 | m_bankingTimescale = 2; | 390 | vd.m_bankingTimescale = 2; |
383 | m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | | 391 | vd.m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | |
384 | VehicleFlag.HOVER_TERRAIN_ONLY | | 392 | VehicleFlag.HOVER_TERRAIN_ONLY | |
385 | VehicleFlag.HOVER_GLOBAL_HEIGHT | | 393 | VehicleFlag.HOVER_GLOBAL_HEIGHT | |
386 | VehicleFlag.HOVER_UP_ONLY | | 394 | VehicleFlag.HOVER_UP_ONLY | |
387 | VehicleFlag.NO_DEFLECTION_UP | | 395 | VehicleFlag.NO_DEFLECTION_UP | |
388 | VehicleFlag.LIMIT_MOTOR_UP); | 396 | VehicleFlag.LIMIT_MOTOR_UP); |
389 | m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY); | 397 | vd.m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY); |
390 | break; | 398 | break; |
391 | case Vehicle.TYPE_BALLOON: | 399 | case Vehicle.TYPE_BALLOON: |
392 | m_linearFrictionTimescale = new Vector3(5, 5, 5); | 400 | vd.m_linearFrictionTimescale = new Vector3(5, 5, 5); |
393 | m_angularFrictionTimescale = new Vector3(10, 10, 10); | 401 | vd.m_angularFrictionTimescale = new Vector3(10, 10, 10); |
394 | m_linearMotorTimescale = 5; | 402 | vd.m_linearMotorTimescale = 5; |
395 | m_linearMotorDecayTimescale = 60; | 403 | vd.m_linearMotorDecayTimescale = 60; |
396 | m_angularMotorTimescale = 6; | 404 | vd.m_angularMotorTimescale = 6; |
397 | m_angularMotorDecayTimescale = 10; | 405 | vd.m_angularMotorDecayTimescale = 10; |
398 | m_VhoverHeight = 5; | 406 | vd.m_VhoverHeight = 5; |
399 | m_VhoverEfficiency = 0.8f; | 407 | vd.m_VhoverEfficiency = 0.8f; |
400 | m_VhoverTimescale = 10; | 408 | vd.m_VhoverTimescale = 10; |
401 | m_VehicleBuoyancy = 1; | 409 | vd.m_VehicleBuoyancy = 1; |
402 | m_linearDeflectionEfficiency = 0; | 410 | vd.m_linearDeflectionEfficiency = 0; |
403 | m_linearDeflectionTimescale = 5; | 411 | vd.m_linearDeflectionTimescale = 5; |
404 | m_angularDeflectionEfficiency = 0; | 412 | vd.m_angularDeflectionEfficiency = 0; |
405 | m_angularDeflectionTimescale = 5; | 413 | vd.m_angularDeflectionTimescale = 5; |
406 | m_verticalAttractionEfficiency = 0f; | 414 | vd.m_verticalAttractionEfficiency = 0f; |
407 | m_verticalAttractionTimescale = 1000f; | 415 | vd.m_verticalAttractionTimescale = 1000f; |
408 | m_bankingEfficiency = 0; | 416 | vd.m_bankingEfficiency = 0; |
409 | m_bankingMix = 0.7f; | 417 | vd.m_bankingMix = 0.7f; |
410 | m_bankingTimescale = 5; | 418 | vd.m_bankingTimescale = 5; |
411 | m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | | 419 | vd.m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | |
412 | VehicleFlag.HOVER_TERRAIN_ONLY | | 420 | VehicleFlag.HOVER_TERRAIN_ONLY | |
413 | VehicleFlag.HOVER_UP_ONLY | | 421 | VehicleFlag.HOVER_UP_ONLY | |
414 | VehicleFlag.NO_DEFLECTION_UP | | 422 | VehicleFlag.NO_DEFLECTION_UP | |
415 | VehicleFlag.LIMIT_MOTOR_UP); | 423 | VehicleFlag.LIMIT_MOTOR_UP); |
416 | m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY | | 424 | vd.m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY | |
417 | VehicleFlag.HOVER_GLOBAL_HEIGHT); | 425 | VehicleFlag.HOVER_GLOBAL_HEIGHT); |
418 | break; | 426 | break; |
419 | } | 427 | } |
@@ -424,7 +432,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
424 | // crap crap crap | 432 | // crap crap crap |
425 | if (ph == null) // what ?? | 433 | if (ph == null) // what ?? |
426 | return; | 434 | return; |
427 | 435 | ph.SetVehicle(vd); | |
436 | /* | ||
428 | ph.VehicleType = (int)m_type; | 437 | ph.VehicleType = (int)m_type; |
429 | 438 | ||
430 | // Linear properties | 439 | // Linear properties |
@@ -465,6 +474,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
465 | 474 | ||
466 | ph.VehicleFlags(~(int)m_flags, true); | 475 | ph.VehicleFlags(~(int)m_flags, true); |
467 | ph.VehicleFlags((int)m_flags, false); | 476 | ph.VehicleFlags((int)m_flags, false); |
477 | */ | ||
468 | } | 478 | } |
469 | } | 479 | } |
470 | } \ No newline at end of file | 480 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 324fdb8..1cce4c0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1965,6 +1965,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1965 | /// <returns></returns> | 1965 | /// <returns></returns> |
1966 | public SceneObjectGroup Copy(bool userExposed) | 1966 | public SceneObjectGroup Copy(bool userExposed) |
1967 | { | 1967 | { |
1968 | m_dupeInProgress = true; | ||
1968 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); | 1969 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); |
1969 | dupe.m_isBackedUp = false; | 1970 | dupe.m_isBackedUp = false; |
1970 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); | 1971 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); |
@@ -2048,6 +2049,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2048 | ScheduleGroupForFullUpdate(); | 2049 | ScheduleGroupForFullUpdate(); |
2049 | } | 2050 | } |
2050 | 2051 | ||
2052 | m_dupeInProgress = false; | ||
2051 | return dupe; | 2053 | return dupe; |
2052 | } | 2054 | } |
2053 | 2055 | ||
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs index 6e28bfa..2306309 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs | |||
@@ -22,7 +22,8 @@ | |||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 | * | 24 | * |
25 | * Revised March 5th 2010 by Kitto Flora. ODEDynamics.cs | 25 | * Revised March 5th 2010 by Kitto Flora. ODEDynamics.cs |
26 | * Ubit 2012 | ||
26 | * rolled into ODEPrim.cs | 27 | * rolled into ODEPrim.cs |
27 | */ | 28 | */ |
28 | 29 | ||
@@ -38,7 +39,6 @@ using Ode.NET; | |||
38 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
39 | using OpenSim.Region.Physics.Manager; | 40 | using OpenSim.Region.Physics.Manager; |
40 | 41 | ||
41 | |||
42 | namespace OpenSim.Region.Physics.OdePlugin | 42 | namespace OpenSim.Region.Physics.OdePlugin |
43 | { | 43 | { |
44 | /// <summary> | 44 | /// <summary> |
@@ -254,6 +254,61 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
254 | private float m_verticalAttractionTimescale = 500f; // Timescale > 300 means no vert attractor. | 254 | private float m_verticalAttractionTimescale = 500f; // Timescale > 300 means no vert attractor. |
255 | 255 | ||
256 | SerialControl m_taintserial = null; | 256 | SerialControl m_taintserial = null; |
257 | object m_taintvehicledata = null; | ||
258 | |||
259 | public void DoSetVehicle() | ||
260 | { | ||
261 | VehicleData vd = (VehicleData)m_taintvehicledata; | ||
262 | |||
263 | m_type = vd.m_type; | ||
264 | m_flags = vd.m_flags; | ||
265 | |||
266 | // Linear properties | ||
267 | m_linearMotorDirection = vd.m_linearMotorDirection; | ||
268 | m_linearFrictionTimescale = vd.m_linearFrictionTimescale; | ||
269 | m_linearMotorDecayTimescale = vd.m_linearMotorDecayTimescale; | ||
270 | m_linearMotorTimescale = vd.m_linearMotorTimescale; | ||
271 | // m_linearMotorOffset = vd.m_linearMotorOffset; | ||
272 | |||
273 | //Angular properties | ||
274 | m_angularMotorDirection = vd.m_angularMotorDirection; | ||
275 | m_angularMotorTimescale = vd.m_angularMotorTimescale; | ||
276 | m_angularMotorDecayTimescale = vd.m_angularMotorDecayTimescale; | ||
277 | m_angularFrictionTimescale = vd.m_angularFrictionTimescale; | ||
278 | |||
279 | //Deflection properties | ||
280 | // m_angularDeflectionEfficiency = vd.m_angularDeflectionEfficiency; | ||
281 | // m_angularDeflectionTimescale = vd.m_angularDeflectionTimescale; | ||
282 | // m_linearDeflectionEfficiency = vd.m_linearDeflectionEfficiency; | ||
283 | // m_linearDeflectionTimescale = vd.m_linearDeflectionTimescale; | ||
284 | |||
285 | //Banking properties | ||
286 | // m_bankingEfficiency = vd.m_bankingEfficiency; | ||
287 | // m_bankingMix = vd.m_bankingMix; | ||
288 | // m_bankingTimescale = vd.m_bankingTimescale; | ||
289 | |||
290 | //Hover and Buoyancy properties | ||
291 | m_VhoverHeight = vd.m_VhoverHeight; | ||
292 | // m_VhoverEfficiency = vd.m_VhoverEfficiency; | ||
293 | m_VhoverTimescale = vd.m_VhoverTimescale; | ||
294 | m_VehicleBuoyancy = vd.m_VehicleBuoyancy; | ||
295 | |||
296 | //Attractor properties | ||
297 | m_verticalAttractionEfficiency = vd.m_verticalAttractionEfficiency; | ||
298 | m_verticalAttractionTimescale = vd.m_verticalAttractionTimescale; | ||
299 | |||
300 | // Axis | ||
301 | // m_referenceFrame = vd.m_referenceFrame; | ||
302 | |||
303 | |||
304 | m_taintvehicledata = null; | ||
305 | } | ||
306 | |||
307 | public override void SetVehicle(object vdata) | ||
308 | { | ||
309 | m_taintvehicledata = vdata; | ||
310 | _parent_scene.AddPhysicsActorTaint(this); | ||
311 | } | ||
257 | 312 | ||
258 | public override byte[] Serialize(bool PhysIsRunning) | 313 | public override byte[] Serialize(bool PhysIsRunning) |
259 | { | 314 | { |
@@ -1843,6 +1898,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1843 | if (m_taintCollidesWater != m_collidesWater) | 1898 | if (m_taintCollidesWater != m_collidesWater) |
1844 | changefloatonwater(timestep); | 1899 | changefloatonwater(timestep); |
1845 | 1900 | ||
1901 | if (m_taintvehicledata != null) | ||
1902 | DoSetVehicle(); | ||
1903 | |||
1846 | if (m_taintserial != null) | 1904 | if (m_taintserial != null) |
1847 | DoSerialize(m_taintserial); | 1905 | DoSerialize(m_taintserial); |
1848 | 1906 | ||
diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdeUtils.cs b/OpenSim/Region/Physics/ChOdePlugin/OdeUtils.cs index edd58d3..e7e7bb3 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/OdeUtils.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/OdeUtils.cs | |||
@@ -1,5 +1,17 @@ | |||
1 | // adapted from libomv removing cpu endian adjust | 1 | /* Ubit 2012 |
2 | // for prims lowlevel serialization | 2 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
3 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
4 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
5 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
6 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
7 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
8 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
9 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
10 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
11 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
12 | */ | ||
13 | |||
14 | // no endian conversion. So can't be use to pass information around diferent cpus with diferent endian | ||
3 | 15 | ||
4 | using System; | 16 | using System; |
5 | using System.IO; | 17 | using System.IO; |
@@ -7,77 +19,168 @@ using OpenMetaverse; | |||
7 | 19 | ||
8 | namespace OpenSim.Region.Physics.OdePlugin | 20 | namespace OpenSim.Region.Physics.OdePlugin |
9 | { | 21 | { |
10 | public class wstreamer | 22 | |
23 | unsafe public class wstreamer | ||
11 | { | 24 | { |
12 | private MemoryStream st; | 25 | byte[] buf; |
26 | int index; | ||
27 | byte* src; | ||
13 | 28 | ||
14 | public wstreamer() | 29 | public wstreamer() |
15 | { | 30 | { |
16 | st = new MemoryStream(); | 31 | buf = new byte[1024]; |
32 | index = 0; | ||
33 | } | ||
34 | public wstreamer(int size) | ||
35 | { | ||
36 | buf = new byte[size]; | ||
37 | index = 0; | ||
17 | } | 38 | } |
18 | 39 | ||
19 | public byte[] close() | 40 | public byte[] close() |
20 | { | 41 | { |
21 | byte[] data = st.ToArray(); | 42 | byte[] data = new byte[index]; |
22 | st.Close(); | 43 | Buffer.BlockCopy(buf, 0, data, 0, index); |
23 | return data; | 44 | return data; |
24 | } | 45 | } |
25 | 46 | ||
47 | public void Seek(int pos) | ||
48 | { | ||
49 | index = pos; | ||
50 | } | ||
51 | |||
52 | public void Seekrel(int pos) | ||
53 | { | ||
54 | index += pos; | ||
55 | } | ||
56 | |||
57 | public void Wbyte(byte value) | ||
58 | { | ||
59 | buf[index++] = value; | ||
60 | } | ||
26 | public void Wshort(short value) | 61 | public void Wshort(short value) |
27 | { | 62 | { |
28 | st.Write(BitConverter.GetBytes(value), 0, 2); | 63 | src = (byte*)&value; |
64 | buf[index++] = *src++; | ||
65 | buf[index++] = *src; | ||
29 | } | 66 | } |
30 | public void Wushort(ushort value) | 67 | public void Wushort(ushort value) |
31 | { | 68 | { |
32 | byte[] t = BitConverter.GetBytes(value); | 69 | src = (byte*)&value; |
33 | st.Write(BitConverter.GetBytes(value), 0, 2); | 70 | buf[index++] = *src++; |
71 | buf[index++] = *src; | ||
34 | } | 72 | } |
35 | public void Wint(int value) | 73 | public void Wint(int value) |
36 | { | 74 | { |
37 | st.Write(BitConverter.GetBytes(value), 0, 4); | 75 | src = (byte*)&value; |
76 | buf[index++] = *src++; | ||
77 | buf[index++] = *src++; | ||
78 | buf[index++] = *src++; | ||
79 | buf[index++] = *src; | ||
38 | } | 80 | } |
39 | public void Wuint(uint value) | 81 | public void Wuint(uint value) |
40 | { | 82 | { |
41 | st.Write(BitConverter.GetBytes(value), 0, 4); | 83 | src = (byte*)&value; |
84 | buf[index++] = *src++; | ||
85 | buf[index++] = *src++; | ||
86 | buf[index++] = *src++; | ||
87 | buf[index++] = *src; | ||
42 | } | 88 | } |
43 | public void Wlong(long value) | 89 | public void Wlong(long value) |
44 | { | 90 | { |
45 | st.Write(BitConverter.GetBytes(value), 0, 8); | 91 | src = (byte*)&value; |
92 | buf[index++] = *src++; | ||
93 | buf[index++] = *src++; | ||
94 | buf[index++] = *src++; | ||
95 | buf[index++] = *src++; | ||
96 | buf[index++] = *src++; | ||
97 | buf[index++] = *src++; | ||
98 | buf[index++] = *src++; | ||
99 | buf[index++] = *src; | ||
46 | } | 100 | } |
47 | public void Wulong(ulong value) | 101 | public void Wulong(ulong value) |
48 | { | 102 | { |
49 | st.Write(BitConverter.GetBytes(value), 0, 8); | 103 | src = (byte*)&value; |
104 | buf[index++] = *src++; | ||
105 | buf[index++] = *src++; | ||
106 | buf[index++] = *src++; | ||
107 | buf[index++] = *src++; | ||
108 | buf[index++] = *src++; | ||
109 | buf[index++] = *src++; | ||
110 | buf[index++] = *src++; | ||
111 | buf[index++] = *src; | ||
50 | } | 112 | } |
51 | 113 | ||
52 | public void Wfloat(float value) | 114 | public void Wfloat(float value) |
53 | { | 115 | { |
54 | st.Write(BitConverter.GetBytes(value), 0, 4); | 116 | src = (byte*)&value; |
117 | buf[index++] = *src++; | ||
118 | buf[index++] = *src++; | ||
119 | buf[index++] = *src++; | ||
120 | buf[index++] = *src; | ||
55 | } | 121 | } |
56 | 122 | ||
57 | public void Wdouble(double value) | 123 | public void Wdouble(double value) |
58 | { | 124 | { |
59 | st.Write(BitConverter.GetBytes(value), 0, 8); | 125 | src = (byte*)&value; |
126 | buf[index++] = *src++; | ||
127 | buf[index++] = *src++; | ||
128 | buf[index++] = *src++; | ||
129 | buf[index++] = *src++; | ||
130 | buf[index++] = *src++; | ||
131 | buf[index++] = *src++; | ||
132 | buf[index++] = *src++; | ||
133 | buf[index++] = *src; | ||
60 | } | 134 | } |
61 | 135 | ||
62 | public void Wvector3(Vector3 value) | 136 | public void Wvector3(Vector3 value) |
63 | { | 137 | { |
64 | st.Write(BitConverter.GetBytes(value.X), 0, 4); | 138 | src = (byte*)&value.X; |
65 | st.Write(BitConverter.GetBytes(value.Y), 0, 4); | 139 | buf[index++] = *src++; |
66 | st.Write(BitConverter.GetBytes(value.Z), 0, 4); | 140 | buf[index++] = *src++; |
141 | buf[index++] = *src++; | ||
142 | buf[index++] = *src; | ||
143 | src = (byte*)&value.Y; // it may have padding ?? | ||
144 | buf[index++] = *src++; | ||
145 | buf[index++] = *src++; | ||
146 | buf[index++] = *src++; | ||
147 | buf[index++] = *src; | ||
148 | src = (byte*)&value.Z; | ||
149 | buf[index++] = *src++; | ||
150 | buf[index++] = *src++; | ||
151 | buf[index++] = *src++; | ||
152 | buf[index++] = *src; | ||
67 | } | 153 | } |
68 | public void Wquat(Quaternion value) | 154 | public void Wquat(Quaternion value) |
69 | { | 155 | { |
70 | st.Write(BitConverter.GetBytes(value.X), 0, 4); | 156 | src = (byte*)&value.X; |
71 | st.Write(BitConverter.GetBytes(value.Y), 0, 4); | 157 | buf[index++] = *src++; |
72 | st.Write(BitConverter.GetBytes(value.Z), 0, 4); | 158 | buf[index++] = *src++; |
73 | st.Write(BitConverter.GetBytes(value.W), 0, 4); | 159 | buf[index++] = *src++; |
160 | buf[index++] = *src; | ||
161 | src = (byte*)&value.Y; // it may have padding ?? | ||
162 | buf[index++] = *src++; | ||
163 | buf[index++] = *src++; | ||
164 | buf[index++] = *src++; | ||
165 | buf[index++] = *src; | ||
166 | src = (byte*)&value.Z; | ||
167 | buf[index++] = *src++; | ||
168 | buf[index++] = *src++; | ||
169 | buf[index++] = *src++; | ||
170 | buf[index++] = *src; | ||
171 | src = (byte*)&value.W; | ||
172 | buf[index++] = *src++; | ||
173 | buf[index++] = *src++; | ||
174 | buf[index++] = *src++; | ||
175 | buf[index++] = *src; | ||
74 | } | 176 | } |
75 | } | 177 | } |
76 | 178 | ||
77 | public class rstreamer | 179 | unsafe public class rstreamer |
78 | { | 180 | { |
79 | private byte[] rbuf; | 181 | private byte[] rbuf; |
80 | private int ptr; | 182 | private int ptr; |
183 | private byte* dst; | ||
81 | 184 | ||
82 | public rstreamer(byte[] data) | 185 | public rstreamer(byte[] data) |
83 | { | 186 | { |
@@ -89,78 +192,161 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
89 | { | 192 | { |
90 | } | 193 | } |
91 | 194 | ||
195 | public void Seek(int pos) | ||
196 | { | ||
197 | ptr = pos; | ||
198 | } | ||
199 | |||
200 | public void Seekrel(int pos) | ||
201 | { | ||
202 | ptr += pos; | ||
203 | } | ||
204 | |||
205 | public byte Rbyte() | ||
206 | { | ||
207 | return (byte)rbuf[ptr++]; | ||
208 | } | ||
209 | |||
92 | public short Rshort() | 210 | public short Rshort() |
93 | { | 211 | { |
94 | short v = BitConverter.ToInt16(rbuf, ptr); | 212 | short v; |
95 | ptr += 2; | 213 | dst = (byte*)&v; |
214 | *dst++ = rbuf[ptr++]; | ||
215 | *dst = rbuf[ptr++]; | ||
96 | return v; | 216 | return v; |
97 | } | 217 | } |
98 | public ushort Rushort() | 218 | public ushort Rushort() |
99 | { | 219 | { |
100 | ushort v = BitConverter.ToUInt16(rbuf, ptr); | 220 | ushort v; |
101 | ptr += 2; | 221 | dst = (byte*)&v; |
222 | *dst++ = rbuf[ptr++]; | ||
223 | *dst = rbuf[ptr++]; | ||
102 | return v; | 224 | return v; |
103 | } | 225 | } |
104 | public int Rint() | 226 | public int Rint() |
105 | { | 227 | { |
106 | int v = BitConverter.ToInt32(rbuf, ptr); | 228 | int v; |
107 | ptr += 4; | 229 | dst = (byte*)&v; |
230 | *dst++ = rbuf[ptr++]; | ||
231 | *dst++ = rbuf[ptr++]; | ||
232 | *dst++ = rbuf[ptr++]; | ||
233 | *dst = rbuf[ptr++]; | ||
108 | return v; | 234 | return v; |
109 | } | 235 | } |
110 | public uint Ruint() | 236 | public uint Ruint() |
111 | { | 237 | { |
112 | uint v = BitConverter.ToUInt32(rbuf, ptr); | 238 | uint v; |
113 | ptr += 4; | 239 | dst = (byte*)&v; |
240 | *dst++ = rbuf[ptr++]; | ||
241 | *dst++ = rbuf[ptr++]; | ||
242 | *dst++ = rbuf[ptr++]; | ||
243 | *dst = rbuf[ptr++]; | ||
114 | return v; | 244 | return v; |
115 | } | 245 | } |
116 | public long Rlong() | 246 | public long Rlong() |
117 | { | 247 | { |
118 | long v = BitConverter.ToInt64(rbuf, ptr); | 248 | long v; |
119 | ptr += 8; | 249 | dst = (byte*)&v; |
250 | *dst++ = rbuf[ptr++]; | ||
251 | *dst++ = rbuf[ptr++]; | ||
252 | *dst++ = rbuf[ptr++]; | ||
253 | *dst++ = rbuf[ptr++]; | ||
254 | *dst++ = rbuf[ptr++]; | ||
255 | *dst++ = rbuf[ptr++]; | ||
256 | *dst++ = rbuf[ptr++]; | ||
257 | *dst = rbuf[ptr++]; | ||
120 | return v; | 258 | return v; |
121 | } | 259 | } |
122 | public ulong Rulong() | 260 | public ulong Rulong() |
123 | { | 261 | { |
124 | ulong v = BitConverter.ToUInt64(rbuf, ptr); | 262 | ulong v; |
125 | ptr += 8; | 263 | dst = (byte*)&v; |
264 | *dst++ = rbuf[ptr++]; | ||
265 | *dst++ = rbuf[ptr++]; | ||
266 | *dst++ = rbuf[ptr++]; | ||
267 | *dst++ = rbuf[ptr++]; | ||
268 | *dst++ = rbuf[ptr++]; | ||
269 | *dst++ = rbuf[ptr++]; | ||
270 | *dst++ = rbuf[ptr++]; | ||
271 | *dst = rbuf[ptr++]; | ||
126 | return v; | 272 | return v; |
127 | } | 273 | } |
128 | public float Rfloat() | 274 | public float Rfloat() |
129 | { | 275 | { |
130 | float v = BitConverter.ToSingle(rbuf, ptr); | 276 | float v; |
131 | ptr += 4; | 277 | dst = (byte*)&v; |
278 | *dst++ = rbuf[ptr++]; | ||
279 | *dst++ = rbuf[ptr++]; | ||
280 | *dst++ = rbuf[ptr++]; | ||
281 | *dst = rbuf[ptr++]; | ||
132 | return v; | 282 | return v; |
133 | } | 283 | } |
134 | 284 | ||
135 | public double Rdouble() | 285 | public double Rdouble() |
136 | { | 286 | { |
137 | double v = BitConverter.ToDouble(rbuf, ptr); | 287 | double v; |
138 | ptr += 8; | 288 | dst = (byte*)&v; |
289 | *dst++ = rbuf[ptr++]; | ||
290 | *dst++ = rbuf[ptr++]; | ||
291 | *dst++ = rbuf[ptr++]; | ||
292 | *dst++ = rbuf[ptr++]; | ||
293 | *dst++ = rbuf[ptr++]; | ||
294 | *dst++ = rbuf[ptr++]; | ||
295 | *dst++ = rbuf[ptr++]; | ||
296 | *dst = rbuf[ptr++]; | ||
139 | return v; | 297 | return v; |
140 | } | 298 | } |
141 | 299 | ||
142 | public Vector3 Rvector3() | 300 | public Vector3 Rvector3() |
143 | { | 301 | { |
144 | Vector3 v; | 302 | Vector3 v; |
145 | v.X = BitConverter.ToSingle(rbuf, ptr); | 303 | dst = (byte*)&v.X; |
146 | ptr += 4; | 304 | *dst++ = rbuf[ptr++]; |
147 | v.Y = BitConverter.ToSingle(rbuf, ptr); | 305 | *dst++ = rbuf[ptr++]; |
148 | ptr += 4; | 306 | *dst++ = rbuf[ptr++]; |
149 | v.Z = BitConverter.ToSingle(rbuf, ptr); | 307 | *dst = rbuf[ptr++]; |
150 | ptr += 4; | 308 | |
309 | dst = (byte*)&v.Y; | ||
310 | *dst++ = rbuf[ptr++]; | ||
311 | *dst++ = rbuf[ptr++]; | ||
312 | *dst++ = rbuf[ptr++]; | ||
313 | *dst = rbuf[ptr++]; | ||
314 | |||
315 | dst = (byte*)&v.Z; | ||
316 | *dst++ = rbuf[ptr++]; | ||
317 | *dst++ = rbuf[ptr++]; | ||
318 | *dst++ = rbuf[ptr++]; | ||
319 | *dst = rbuf[ptr++]; | ||
151 | return v; | 320 | return v; |
152 | } | 321 | } |
322 | |||
153 | public Quaternion Rquat() | 323 | public Quaternion Rquat() |
154 | { | 324 | { |
155 | Quaternion v; | 325 | Quaternion v; |
156 | v.X = BitConverter.ToSingle(rbuf, ptr); | 326 | dst = (byte*)&v.X; |
157 | ptr += 4; | 327 | *dst++ = rbuf[ptr++]; |
158 | v.Y = BitConverter.ToSingle(rbuf, ptr); | 328 | *dst++ = rbuf[ptr++]; |
159 | ptr += 4; | 329 | *dst++ = rbuf[ptr++]; |
160 | v.Z = BitConverter.ToSingle(rbuf, ptr); | 330 | *dst = rbuf[ptr++]; |
161 | ptr += 4; | 331 | |
162 | v.W = BitConverter.ToSingle(rbuf, ptr); | 332 | dst = (byte*)&v.Y; |
163 | ptr += 4; | 333 | *dst++ = rbuf[ptr++]; |
334 | *dst++ = rbuf[ptr++]; | ||
335 | *dst++ = rbuf[ptr++]; | ||
336 | *dst = rbuf[ptr++]; | ||
337 | |||
338 | dst = (byte*)&v.Z; | ||
339 | *dst++ = rbuf[ptr++]; | ||
340 | *dst++ = rbuf[ptr++]; | ||
341 | *dst++ = rbuf[ptr++]; | ||
342 | *dst = rbuf[ptr++]; | ||
343 | |||
344 | dst = (byte*)&v.W; | ||
345 | *dst++ = rbuf[ptr++]; | ||
346 | *dst++ = rbuf[ptr++]; | ||
347 | *dst++ = rbuf[ptr++]; | ||
348 | *dst = rbuf[ptr++]; | ||
349 | |||
164 | return v; | 350 | return v; |
165 | } | 351 | } |
166 | } | 352 | } |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index eb0228a..f525e9e 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -146,6 +146,8 @@ namespace OpenSim.Region.Physics.Manager | |||
146 | /// </summary> | 146 | /// </summary> |
147 | public event CollisionUpdate OnCollisionUpdate; | 147 | public event CollisionUpdate OnCollisionUpdate; |
148 | 148 | ||
149 | public virtual void SetVehicle(object vdata) { } | ||
150 | |||
149 | public event OutOfBounds OnOutOfBounds; | 151 | public event OutOfBounds OnOutOfBounds; |
150 | #pragma warning restore 67 | 152 | #pragma warning restore 67 |
151 | 153 | ||
@@ -153,8 +155,7 @@ namespace OpenSim.Region.Physics.Manager | |||
153 | { | 155 | { |
154 | get { return new NullPhysicsActor(); } | 156 | get { return new NullPhysicsActor(); } |
155 | } | 157 | } |
156 | 158 | ||
157 | |||
158 | public virtual bool Building { get; set; } | 159 | public virtual bool Building { get; set; } |
159 | 160 | ||
160 | public virtual ContactData ContactData | 161 | public virtual ContactData ContactData |
diff --git a/OpenSim/Region/Physics/Manager/VehicleConstants.cs b/OpenSim/Region/Physics/Manager/VehicleConstants.cs index f0775c1..8e24b4c 100644 --- a/OpenSim/Region/Physics/Manager/VehicleConstants.cs +++ b/OpenSim/Region/Physics/Manager/VehicleConstants.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using OpenMetaverse; | ||
29 | 30 | ||
30 | namespace OpenSim.Region.Physics.Manager | 31 | namespace OpenSim.Region.Physics.Manager |
31 | { | 32 | { |
@@ -117,5 +118,47 @@ namespace OpenSim.Region.Physics.Manager | |||
117 | NO_DEFLECTION = 16392, | 118 | NO_DEFLECTION = 16392, |
118 | LOCK_ROTATION = 32784 | 119 | LOCK_ROTATION = 32784 |
119 | } | 120 | } |
120 | 121 | ||
122 | public struct VehicleData | ||
123 | { | ||
124 | public Vehicle m_type; | ||
125 | public VehicleFlag m_flags; | ||
126 | |||
127 | // Linear properties | ||
128 | public Vector3 m_linearMotorDirection; | ||
129 | public Vector3 m_linearFrictionTimescale; | ||
130 | public float m_linearMotorDecayTimescale; | ||
131 | public float m_linearMotorTimescale; | ||
132 | public Vector3 m_linearMotorOffset; | ||
133 | |||
134 | //Angular properties | ||
135 | public Vector3 m_angularMotorDirection; | ||
136 | public float m_angularMotorTimescale; | ||
137 | public float m_angularMotorDecayTimescale; | ||
138 | public Vector3 m_angularFrictionTimescale; | ||
139 | |||
140 | //Deflection properties | ||
141 | public float m_angularDeflectionEfficiency; | ||
142 | public float m_angularDeflectionTimescale; | ||
143 | public float m_linearDeflectionEfficiency; | ||
144 | public float m_linearDeflectionTimescale; | ||
145 | |||
146 | //Banking properties | ||
147 | public float m_bankingEfficiency; | ||
148 | public float m_bankingMix; | ||
149 | public float m_bankingTimescale; | ||
150 | |||
151 | //Hover and Buoyancy properties | ||
152 | public float m_VhoverHeight; | ||
153 | public float m_VhoverEfficiency; | ||
154 | public float m_VhoverTimescale; | ||
155 | public float m_VehicleBuoyancy; | ||
156 | |||
157 | //Attractor properties | ||
158 | public float m_verticalAttractionEfficiency; | ||
159 | public float m_verticalAttractionTimescale; | ||
160 | |||
161 | // Axis | ||
162 | public Quaternion m_referenceFrame; | ||
163 | } | ||
121 | } | 164 | } |