diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 84 |
1 files changed, 56 insertions, 28 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f1e781c..7b1f5d2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1856,6 +1856,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
1856 | } | 1856 | } |
1857 | } | 1857 | } |
1858 | 1858 | ||
1859 | // SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future | ||
1860 | public void SetVelocity(Vector3 pVel, bool localGlobalTF) | ||
1861 | { | ||
1862 | if (ParentGroup == null || ParentGroup.IsDeleted) | ||
1863 | return; | ||
1864 | |||
1865 | if (ParentGroup.IsAttachment) | ||
1866 | return; // don't work on attachments (for now ??) | ||
1867 | |||
1868 | SceneObjectPart root = ParentGroup.RootPart; | ||
1869 | |||
1870 | if (root.VehicleType != (int)Vehicle.TYPE_NONE) // don't mess with vehicles | ||
1871 | return; | ||
1872 | |||
1873 | PhysicsActor pa = root.PhysActor; | ||
1874 | |||
1875 | if (pa == null || !pa.IsPhysical) | ||
1876 | return; | ||
1877 | |||
1878 | if (localGlobalTF) | ||
1879 | { | ||
1880 | pVel = pVel * GetWorldRotation(); | ||
1881 | } | ||
1882 | |||
1883 | ParentGroup.Velocity = pVel; | ||
1884 | } | ||
1885 | |||
1886 | |||
1859 | /// <summary> | 1887 | /// <summary> |
1860 | /// hook to the physics scene to apply angular impulse | 1888 | /// hook to the physics scene to apply angular impulse |
1861 | /// This is sent up to the group, which then finds the root prim | 1889 | /// This is sent up to the group, which then finds the root prim |
@@ -4512,7 +4540,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4512 | { | 4540 | { |
4513 | if (pa != null) | 4541 | if (pa != null) |
4514 | { | 4542 | { |
4515 | ParentGroup.Scene.RemovePhysicalPrim(1); | 4543 | if(wasUsingPhysics) |
4544 | ParentGroup.Scene.RemovePhysicalPrim(1); | ||
4516 | RemoveFromPhysics(); | 4545 | RemoveFromPhysics(); |
4517 | } | 4546 | } |
4518 | 4547 | ||
@@ -4529,37 +4558,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
4529 | { | 4558 | { |
4530 | AddToPhysics(UsePhysics, SetPhantom, building, false); | 4559 | AddToPhysics(UsePhysics, SetPhantom, building, false); |
4531 | pa = PhysActor; | 4560 | pa = PhysActor; |
4532 | /* | 4561 | /* |
4533 | if (pa != null) | 4562 | if (pa != null) |
4534 | { | 4563 | { |
4535 | if ( | 4564 | if ( |
4536 | // ((AggregateScriptEvents & scriptEvents.collision) != 0) || | 4565 | // ((AggregateScriptEvents & scriptEvents.collision) != 0) || |
4537 | // ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || | 4566 | // ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || |
4538 | // ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || | 4567 | // ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || |
4539 | // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || | 4568 | // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || |
4540 | // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || | 4569 | // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || |
4541 | // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || | 4570 | // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || |
4542 | ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || | 4571 | ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || |
4543 | ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || | 4572 | ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || |
4544 | (CollisionSound != UUID.Zero) | 4573 | (CollisionSound != UUID.Zero) |
4545 | ) | 4574 | ) |
4546 | { | 4575 | { |
4547 | pa.OnCollisionUpdate += PhysicsCollision; | 4576 | pa.OnCollisionUpdate += PhysicsCollision; |
4548 | pa.SubscribeEvents(1000); | 4577 | pa.SubscribeEvents(1000); |
4549 | } | 4578 | } |
4550 | } | 4579 | } |
4551 | */ | 4580 | */ |
4552 | } | 4581 | } |
4553 | else // it already has a physical representation | 4582 | else // it already has a physical representation |
4554 | { | 4583 | { |
4555 | DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. | 4584 | DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. |
4556 | /* moved into DoPhysicsPropertyUpdate | 4585 | /* moved into DoPhysicsPropertyUpdate |
4557 | if(VolumeDetectActive) | 4586 | if(VolumeDetectActive) |
4558 | pa.SetVolumeDetect(1); | 4587 | pa.SetVolumeDetect(1); |
4559 | else | 4588 | else |
4560 | pa.SetVolumeDetect(0); | 4589 | pa.SetVolumeDetect(0); |
4561 | */ | 4590 | */ |
4562 | |||
4563 | 4591 | ||
4564 | if (pa.Building != building) | 4592 | if (pa.Building != building) |
4565 | pa.Building = building; | 4593 | pa.Building = building; |