* Implemented grab and throw in ODE. It's a little strong still so toss gently at first to test the waters or you'll lose prim to the pit at the edge of the sim. Make sure the object is physical before trying to toss it or it'll just move to the new location.
parent
55dc0dc267
commit
c4687116ad
|
@ -207,7 +207,14 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public bool IsSelected
|
||||
{
|
||||
get { return m_isSelected; }
|
||||
set { m_isSelected = value; }
|
||||
set {
|
||||
m_isSelected = value;
|
||||
// Tell physics engine that group is selected
|
||||
if (m_rootPart.PhysActor != null)
|
||||
{
|
||||
m_rootPart.PhysActor.Selected = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The UUID for the Region this Object is in.
|
||||
|
@ -1039,20 +1046,45 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// If object is physical, apply force to move it around
|
||||
/// If object is not physical, just put it at the resulting location
|
||||
/// </summary>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="offset">Always seems to be 0,0,0, so ignoring</param>
|
||||
/// <param name="pos">New position. We do the math here to turn it into a force</param>
|
||||
/// <param name="remoteClient"></param>
|
||||
public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
|
||||
{
|
||||
|
||||
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
|
||||
{
|
||||
|
||||
if (m_rootPart.PhysActor != null)
|
||||
{
|
||||
if (m_rootPart.PhysActor.IsPhysical)
|
||||
{
|
||||
LLVector3 llmoveforce = pos - AbsolutePosition;
|
||||
PhysicsVector grabforce = new PhysicsVector(llmoveforce.X, llmoveforce.Y, llmoveforce.Z);
|
||||
grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
|
||||
m_rootPart.PhysActor.AddForce(grabforce);
|
||||
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
|
||||
}
|
||||
else
|
||||
{
|
||||
NonPhysicalGrabMovement(pos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NonPhysicalGrabMovement(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void NonPhysicalGrabMovement(LLVector3 pos)
|
||||
{
|
||||
AbsolutePosition = pos;
|
||||
m_rootPart.SendTerseUpdateToAllClients();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -224,6 +224,16 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Grabbed
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool IsPhysical
|
||||
{
|
||||
get { return false; }
|
||||
|
|
|
@ -883,6 +883,16 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Grabbed
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public virtual void SetAcceleration(PhysicsVector accel)
|
||||
{
|
||||
lock (BulletXScene.BulletXLock)
|
||||
|
|
|
@ -122,6 +122,10 @@ namespace OpenSim.Region.Physics.Manager
|
|||
|
||||
public abstract PrimitiveBaseShape Shape { set; }
|
||||
|
||||
public abstract bool Grabbed { set; }
|
||||
|
||||
public abstract bool Selected { set; }
|
||||
|
||||
public virtual void RequestPhysicsterseUpdate()
|
||||
{
|
||||
// Make a temporary copy of the event to avoid possibility of
|
||||
|
@ -190,6 +194,8 @@ namespace OpenSim.Region.Physics.Manager
|
|||
public abstract void AddForce(PhysicsVector force);
|
||||
|
||||
public abstract void SetMomentum(PhysicsVector momentum);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class NullPhysicsActor : PhysicsActor
|
||||
|
@ -206,6 +212,17 @@ namespace OpenSim.Region.Physics.Manager
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Grabbed
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
||||
public override bool CollidingGround
|
||||
{
|
||||
get { return false; }
|
||||
|
|
|
@ -152,6 +152,17 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
set { m_alwaysRun = value; }
|
||||
}
|
||||
|
||||
public override bool Grabbed
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
||||
public override bool IsPhysical
|
||||
{
|
||||
get { return false; }
|
||||
|
|
|
@ -202,6 +202,17 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Grabbed
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
||||
public void enableBody()
|
||||
{
|
||||
// Sets the geom to a body
|
||||
|
|
|
@ -354,6 +354,16 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Grabbed
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool IsPhysical
|
||||
{
|
||||
get { return false; }
|
||||
|
@ -607,5 +617,16 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
get { return false; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Grabbed
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -224,6 +224,16 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Grabbed
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool IsPhysical
|
||||
{
|
||||
get { return false; }
|
||||
|
@ -410,6 +420,16 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Grabbed
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool ThrottleUpdates
|
||||
{
|
||||
get { return false; }
|
||||
|
|
Loading…
Reference in New Issue