BulletSim: change method signatures for internal AddForce methods to remove
confusion about push forces. The latter is an external, physics engine interface feature (the force parameter has a different unit if pushing vs adding force) and that distinction is not used internally.LSLKeyTest
parent
fb57d31538
commit
35d4298be6
|
@ -211,7 +211,7 @@ public class BSActorMoveToTarget : BSActor
|
|||
// Add enough force to overcome the mass of the object
|
||||
addedForce *= m_controllingPrim.Mass;
|
||||
|
||||
m_controllingPrim.AddForce(addedForce, false /* pushForce */, true /* inTaintTime */);
|
||||
m_controllingPrim.AddForce(true /* inTaintTime */, addedForce);
|
||||
}
|
||||
m_physicsScene.DetailLog("{0},BSActorMoveToTarget.Mover3,move,fromPos={1},addedForce={2}",
|
||||
m_controllingPrim.LocalID, origPosition, addedForce);
|
||||
|
|
|
@ -127,7 +127,7 @@ public class BSActorSetTorque : BSActor
|
|||
m_physicsScene.DetailLog("{0},BSActorSetTorque,preStep,force={1}", m_controllingPrim.LocalID, m_controllingPrim.RawTorque);
|
||||
if (m_controllingPrim.PhysBody.HasPhysicalBody)
|
||||
{
|
||||
m_controllingPrim.AddAngularForce(m_controllingPrim.RawTorque, false, true);
|
||||
m_controllingPrim.AddAngularForce(true /* inTaintTime */, m_controllingPrim.RawTorque);
|
||||
m_controllingPrim.ActivateIfPhysical(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -457,7 +457,7 @@ public sealed class BSCharacter : BSPhysObject
|
|||
get { return RawVelocity; }
|
||||
set {
|
||||
RawVelocity = value;
|
||||
OMV.Vector3 vel = RawVelocity;
|
||||
OMV.Vector3 vel = RawVelocity;
|
||||
|
||||
DetailLog("{0}: set Velocity = {1}", LocalID, value);
|
||||
|
||||
|
@ -662,10 +662,10 @@ public sealed class BSCharacter : BSPhysObject
|
|||
addForce *= Mass * BSParam.AvatarAddForcePushFactor;
|
||||
|
||||
DetailLog("{0},BSCharacter.addForce,call,force={1},addForce={2},push={3},mass={4}", LocalID, force, addForce, pushforce, Mass);
|
||||
AddForce(addForce, pushforce, false);
|
||||
AddForce(false, addForce);
|
||||
}
|
||||
|
||||
public override void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) {
|
||||
public override void AddForce(bool inTaintTime, OMV.Vector3 force) {
|
||||
if (force.IsFinite())
|
||||
{
|
||||
OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude);
|
||||
|
@ -692,7 +692,7 @@ public sealed class BSCharacter : BSPhysObject
|
|||
}
|
||||
}
|
||||
|
||||
public override void AddAngularForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) {
|
||||
public override void AddAngularForce(bool inTaintTime, OMV.Vector3 force) {
|
||||
}
|
||||
public override void SetMomentum(OMV.Vector3 momentum) {
|
||||
}
|
||||
|
|
|
@ -768,7 +768,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS
|
|||
}
|
||||
|
||||
if ((m_knownChanged & m_knownChangedForce) != 0)
|
||||
ControllingPrim.AddForce((Vector3)m_knownForce, false /*pushForce*/, true /*inTaintTime*/);
|
||||
ControllingPrim.AddForce(false /* inTaintTime */, (Vector3)m_knownForce);
|
||||
|
||||
if ((m_knownChanged & m_knownChangedForceImpulse) != 0)
|
||||
ControllingPrim.AddForceImpulse((Vector3)m_knownForceImpulse, false /*pushforce*/, true /*inTaintTime*/);
|
||||
|
@ -784,7 +784,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS
|
|||
|
||||
if ((m_knownChanged & m_knownChangedRotationalForce) != 0)
|
||||
{
|
||||
ControllingPrim.AddAngularForce((Vector3)m_knownRotationalForce, false /*pushForce*/, true /*inTaintTime*/);
|
||||
ControllingPrim.AddAngularForce(true /* inTaintTime */, (Vector3)m_knownRotationalForce);
|
||||
}
|
||||
|
||||
// If we set one of the values (ie, the physics engine didn't do it) we must force
|
||||
|
|
|
@ -245,10 +245,10 @@ public abstract class BSPhysObject : PhysicsActor
|
|||
|
||||
public override void AddAngularForce(OMV.Vector3 force, bool pushforce)
|
||||
{
|
||||
AddAngularForce(force, pushforce, false);
|
||||
AddAngularForce(false, force);
|
||||
}
|
||||
public abstract void AddAngularForce(OMV.Vector3 force, bool pushforce, bool inTaintTime);
|
||||
public abstract void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime);
|
||||
public abstract void AddAngularForce(bool inTaintTime, OMV.Vector3 force);
|
||||
public abstract void AddForce(bool inTaintTime, OMV.Vector3 force);
|
||||
|
||||
public abstract OMV.Vector3 ForceRotationalVelocity { get; set; }
|
||||
|
||||
|
|
|
@ -394,7 +394,7 @@ public class BSPrim : BSPhysObject
|
|||
// Apply upforce and overcome gravity.
|
||||
OMV.Vector3 correctionForce = upForce - PhysScene.DefaultGravity;
|
||||
DetailLog("{0},BSPrim.PositionSanityCheck,applyForce,pos={1},upForce={2},correctionForce={3}", LocalID, RawPosition, upForce, correctionForce);
|
||||
AddForce(correctionForce, false, inTaintTime);
|
||||
AddForce(inTaintTime, correctionForce);
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
@ -1249,14 +1249,18 @@ public class BSPrim : BSPhysObject
|
|||
// Per documentation, max force is limited.
|
||||
OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude);
|
||||
|
||||
// Since this force is being applied in only one step, make this a force per second.
|
||||
addForce /= PhysScene.LastTimeStep;
|
||||
AddForce(addForce, pushforce, false /* inTaintTime */);
|
||||
// Push forces seem to be scaled differently (follow pattern in ubODE)
|
||||
if (!pushforce) {
|
||||
// Since this force is being applied in only one step, make this a force per second.
|
||||
addForce /= PhysScene.LastTimeStep;
|
||||
}
|
||||
|
||||
AddForce(false /* inTaintTime */, addForce);
|
||||
}
|
||||
|
||||
// Applying a force just adds this to the total force on the object.
|
||||
// This added force will only last the next simulation tick.
|
||||
public override void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) {
|
||||
public override void AddForce(bool inTaintTime, OMV.Vector3 force) {
|
||||
// for an object, doesn't matter if force is a pushforce or not
|
||||
if (IsPhysicallyActive)
|
||||
{
|
||||
|
@ -1315,7 +1319,7 @@ public class BSPrim : BSPhysObject
|
|||
}
|
||||
|
||||
// BSPhysObject.AddAngularForce()
|
||||
public override void AddAngularForce(OMV.Vector3 force, bool pushforce, bool inTaintTime)
|
||||
public override void AddAngularForce(bool inTaintTime, OMV.Vector3 force)
|
||||
{
|
||||
if (force.IsFinite())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue