From 07893ec3e7e2bfe2066eb0477574543b4efa6930 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 7 Nov 2016 16:03:23 +0000 Subject: [PATCH] a few more changes on the avatars Velocity/TargetVelocity/SetMomentum. Need talk with Robert before last changes bc of bullet --- .../Region/Framework/Scenes/ScenePresence.cs | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6f4d6c3f97..f96fb858ec 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -781,6 +781,34 @@ namespace OpenSim.Region.Framework.Scenes } } + // requested Velocity for physics engines avatar motors + // only makes sense if there is a physical rep + public Vector3 TargetVelocity + { + get + { + if (PhysicsActor != null) + return PhysicsActor.TargetVelocity; + else + return Vector3.Zero; + } + + set + { + if (PhysicsActor != null) + { + try + { + PhysicsActor.TargetVelocity = value; + } + catch (Exception e) + { + m_log.Error("[SCENE PRESENCE]: TARGETVELOCITY " + e.Message); + } + } + } + } + private Quaternion m_bodyRot = Quaternion.Identity; /// @@ -3649,7 +3677,7 @@ namespace OpenSim.Region.Framework.Scenes m_forceToApplyValid = true; } */ - Velocity = direc; + TargetVelocity = direc; Animator.UpdateMovementAnimations(); }