* If you llApplyImpulse on an attachment, it applies impulse on the avatar, not the attachment.

0.6.0-stable
Teravus Ovares 2008-05-06 00:23:19 +00:00
parent 9655cf2807
commit 240e8646da
9 changed files with 51 additions and 21 deletions

View File

@ -1301,8 +1301,19 @@ namespace OpenSim.Region.Environment.Scenes
{
if (rootpart.PhysActor != null)
{
rootpart.PhysActor.AddForce(impulse);
m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
if (rootpart.m_IsAttachment)
{
ScenePresence avatar = m_scene.GetScenePresence(rootpart.m_attachedAvatar);
if (avatar != null)
{
avatar.PushForce(impulse);
}
}
else
{
rootpart.PhysActor.AddForce(impulse,true);
m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
}
}
}
}
@ -1909,7 +1920,7 @@ namespace OpenSim.Region.Environment.Scenes
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_rootPart.PhysActor.AddForce(grabforce,true);
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
}
else

View File

@ -2389,5 +2389,13 @@ namespace OpenSim.Region.Environment.Scenes
info.AddValue("m_knownPrimUUID", knownPrimUUID_work);
}
internal void PushForce(PhysicsVector impulse)
{
if (PhysicsActor != null)
{
PhysicsActor.AddForce(impulse,true);
}
}
}
}

View File

@ -384,7 +384,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
_acceleration = accel;
}
public override void AddForce(PhysicsVector force)
public override void AddForce(PhysicsVector force, bool pushforce)
{
}

View File

@ -917,7 +917,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
set { }
}
public override void AddForce(PhysicsVector force)
public override void AddForce(PhysicsVector force, bool pushforce)
{
}
@ -1134,9 +1134,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin
base.SetAcceleration(accel);
}
public override void AddForce(PhysicsVector force)
public override void AddForce(PhysicsVector force, bool pushforce)
{
base.AddForce(force);
base.AddForce(force, pushforce);
}
public override void SetMomentum(PhysicsVector momentum)
@ -1343,9 +1343,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin
}
}
public override void AddForce(PhysicsVector force)
public override void AddForce(PhysicsVector force, bool pushforce)
{
base.AddForce(force);
base.AddForce(force,pushforce);
}
public override void SetMomentum(PhysicsVector momentum)

View File

@ -196,7 +196,7 @@ namespace OpenSim.Region.Physics.Manager
public abstract float PIDTau { set; }
public abstract void AddForce(PhysicsVector force);
public abstract void AddForce(PhysicsVector force, bool pushforce);
public abstract void SetMomentum(PhysicsVector momentum);
public abstract void SubscribeEvents(int ms);
public abstract void UnSubscribeEvents();
@ -365,7 +365,7 @@ namespace OpenSim.Region.Physics.Manager
{
}
public override void AddForce(PhysicsVector force)
public override void AddForce(PhysicsVector force, bool pushforce)
{
}

View File

@ -610,13 +610,24 @@ namespace OpenSim.Region.Physics.OdePlugin
/// The PID controller takes this target velocity and tries to make it a reality
/// </summary>
/// <param name="force"></param>
public override void AddForce(PhysicsVector force)
public override void AddForce(PhysicsVector force, bool pushforce)
{
m_pidControllerActive = true;
_target_velocity.X += force.X;
_target_velocity.Y += force.Y;
_target_velocity.Z += force.Z;
if (pushforce)
{
m_pidControllerActive = false;
doForce(force);
//_target_velocity.X += force.X;
// _target_velocity.Y += force.Y;
//_target_velocity.Z += force.Z;
}
else
{
m_pidControllerActive = true;
_target_velocity.X += force.X;
_target_velocity.Y += force.Y;
_target_velocity.Z += force.Z;
}
//m_lastUpdateSent = false;
}

View File

@ -1884,7 +1884,7 @@ namespace OpenSim.Region.Physics.OdePlugin
_acceleration = accel;
}
public override void AddForce(PhysicsVector force)
public override void AddForce(PhysicsVector force, bool pushforce)
{
m_forcelist.Add(force);
m_taintforce = true;

View File

@ -513,7 +513,7 @@ namespace OpenSim.Region.Physics.POSPlugin
_acceleration = accel;
}
public override void AddForce(PhysicsVector force)
public override void AddForce(PhysicsVector force, bool pushforce)
{
}
@ -686,7 +686,7 @@ namespace OpenSim.Region.Physics.POSPlugin
_acceleration = accel;
}
public override void AddForce(PhysicsVector force)
public override void AddForce(PhysicsVector force, bool pushforce)
{
}

View File

@ -378,7 +378,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
_acceleration = accel;
}
public override void AddForce(PhysicsVector force)
public override void AddForce(PhysicsVector force, bool pushforce)
{
}
@ -625,7 +625,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
_acceleration = accel;
}
public override void AddForce(PhysicsVector force)
public override void AddForce(PhysicsVector force, bool pushforce)
{
}