From ce7864632bf239a44321cc5806a95a78e0f259ed Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 6 Jul 2012 17:13:11 +0100 Subject: added llSetVelocity. will refuse to work on vehicles and on attachments ( this last may need fix) added also some code for llSetAngularVelocity but not working still --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a48605d..ed32adc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1845,6 +1845,34 @@ namespace OpenSim.Region.Framework.Scenes } } +// SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future + public void SetVelocity(Vector3 pVel, bool localGlobalTF) + { + if (ParentGroup == null || ParentGroup.IsDeleted) + return; + + if (ParentGroup.IsAttachment) + return; // don't work on attachments (for now ??) + + SceneObjectPart root = ParentGroup.RootPart; + + if (root.VehicleType != (int)Vehicle.TYPE_NONE) // don't mess with vehicles + return; + + PhysicsActor pa = root.PhysActor; + + if (pa == null || !pa.IsPhysical) + return; + + if (localGlobalTF) + { + pVel = pVel * GetWorldRotation(); + } + + ParentGroup.Velocity = pVel; + } + + /// /// hook to the physics scene to apply angular impulse /// This is sent up to the group, which then finds the root prim -- cgit v1.1