diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 87 |
1 files changed, 76 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6438694..eb59ffd 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() |
@@ -1556,8 +1559,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1556 | { | 1559 | { |
1557 | PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info | 1560 | PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info |
1558 | PhysActor.SetMaterial(Material); | 1561 | PhysActor.SetMaterial(Material); |
1562 | |||
1563 | // if root part apply vehicle | ||
1564 | if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) | ||
1565 | m_vehicle.SetVehicle(PhysActor); | ||
1566 | |||
1559 | DoPhysicsPropertyUpdate(RigidBody, true); | 1567 | DoPhysicsPropertyUpdate(RigidBody, true); |
1560 | PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); | 1568 | PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); |
1569 | |||
1561 | if (!building) | 1570 | if (!building) |
1562 | PhysActor.Building = false; | 1571 | PhysActor.Building = false; |
1563 | } | 1572 | } |
@@ -3168,39 +3177,90 @@ namespace OpenSim.Region.Framework.Scenes | |||
3168 | } | 3177 | } |
3169 | } | 3178 | } |
3170 | 3179 | ||
3180 | |||
3181 | public int VehicleType | ||
3182 | { | ||
3183 | get | ||
3184 | { | ||
3185 | if (m_vehicle == null) | ||
3186 | return (int)Vehicle.TYPE_NONE; | ||
3187 | else | ||
3188 | return (int)m_vehicle.Type; | ||
3189 | } | ||
3190 | set | ||
3191 | { | ||
3192 | SetVehicleType(value); | ||
3193 | } | ||
3194 | } | ||
3195 | |||
3171 | public void SetVehicleType(int type) | 3196 | public void SetVehicleType(int type) |
3172 | { | 3197 | { |
3173 | if (ParentGroup.IsDeleted) | 3198 | m_vehicle = null; |
3174 | return; | 3199 | if (type == (int)Vehicle.TYPE_NONE) |
3175 | ParentGroup.VehicleType = type; | 3200 | { |
3201 | if (_parentID ==0 && PhysActor != null) | ||
3202 | PhysActor.VehicleType = (int)Vehicle.TYPE_NONE; | ||
3203 | return; | ||
3204 | } | ||
3205 | m_vehicle = new SOPVehicle(); | ||
3206 | m_vehicle.ProcessTypeChange((Vehicle)type); | ||
3207 | { | ||
3208 | if (_parentID ==0 && PhysActor != null) | ||
3209 | PhysActor.VehicleType = type; | ||
3210 | return; | ||
3211 | } | ||
3176 | } | 3212 | } |
3177 | 3213 | ||
3178 | public void SetVehicleFlags(int param, bool remove) | 3214 | public void SetVehicleFlags(int param, bool remove) |
3179 | { | 3215 | { |
3180 | if (ParentGroup.IsDeleted) | 3216 | if (m_vehicle == null) |
3181 | return; | 3217 | return; |
3182 | ParentGroup.SetVehicleFlags(param, remove); | 3218 | |
3219 | m_vehicle.ProcessVehicleFlags(param, remove); | ||
3220 | |||
3221 | if (_parentID ==0 && PhysActor != null) | ||
3222 | { | ||
3223 | PhysActor.VehicleFlags(param, remove); | ||
3224 | } | ||
3183 | } | 3225 | } |
3184 | 3226 | ||
3185 | public void SetVehicleFloatParam(int param, float value) | 3227 | public void SetVehicleFloatParam(int param, float value) |
3186 | { | 3228 | { |
3187 | if (ParentGroup.IsDeleted) | 3229 | if (m_vehicle == null) |
3188 | return; | 3230 | return; |
3189 | ParentGroup.SetVehicleFloatParam(param, value); | 3231 | |
3232 | m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value); | ||
3233 | |||
3234 | if (_parentID == 0 && PhysActor != null) | ||
3235 | { | ||
3236 | PhysActor.VehicleFloatParam(param, value); | ||
3237 | } | ||
3190 | } | 3238 | } |
3191 | 3239 | ||
3192 | public void SetVehicleVectorParam(int param, Vector3 value) | 3240 | public void SetVehicleVectorParam(int param, Vector3 value) |
3193 | { | 3241 | { |
3194 | if (ParentGroup.IsDeleted) | 3242 | if (m_vehicle == null) |
3195 | return; | 3243 | return; |
3196 | ParentGroup.SetVehicleVectorParam(param, value); | 3244 | |
3245 | m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value); | ||
3246 | |||
3247 | if (_parentID == 0 && PhysActor != null) | ||
3248 | { | ||
3249 | PhysActor.VehicleVectorParam(param, value); | ||
3250 | } | ||
3197 | } | 3251 | } |
3198 | 3252 | ||
3199 | public void SetVehicleRotationParam(int param, Quaternion rotation) | 3253 | public void SetVehicleRotationParam(int param, Quaternion rotation) |
3200 | { | 3254 | { |
3201 | if (ParentGroup.IsDeleted) | 3255 | if (m_vehicle == null) |
3202 | return; | 3256 | return; |
3203 | ParentGroup.SetVehicleRotationParam(param, rotation); | 3257 | |
3258 | m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); | ||
3259 | |||
3260 | if (_parentID == 0 && PhysActor != null) | ||
3261 | { | ||
3262 | PhysActor.VehicleRotationParam(param, rotation); | ||
3263 | } | ||
3204 | } | 3264 | } |
3205 | 3265 | ||
3206 | /// <summary> | 3266 | /// <summary> |
@@ -4380,6 +4440,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4380 | m_localId); | 4440 | m_localId); |
4381 | 4441 | ||
4382 | PhysActor.SetMaterial(Material); | 4442 | PhysActor.SetMaterial(Material); |
4443 | |||
4444 | // if root part apply vehicle | ||
4445 | if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) | ||
4446 | m_vehicle.SetVehicle(PhysActor); | ||
4447 | |||
4383 | DoPhysicsPropertyUpdate(UsePhysics, true); | 4448 | DoPhysicsPropertyUpdate(UsePhysics, true); |
4384 | 4449 | ||
4385 | if (!ParentGroup.IsDeleted) | 4450 | if (!ParentGroup.IsDeleted) |