本文整理汇总了C#中OpenMetaverse.IsFinite方法的典型用法代码示例。如果您正苦于以下问题:C# OpenMetaverse.IsFinite方法的具体用法?C# OpenMetaverse.IsFinite怎么用?C# OpenMetaverse.IsFinite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenMetaverse
的用法示例。
在下文中一共展示了OpenMetaverse.IsFinite方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddForce
public override void AddForce(OMV.Vector3 force, bool pushforce) {
if (force.IsFinite())
{
_force.X += force.X;
_force.Y += force.Y;
_force.Z += force.Z;
}
else
{
m_log.WarnFormat("{0}: Got a NaN force applied to a Character", LogHeader);
}
_scene.TaintedObject(delegate()
{
BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force);
});
}
示例2: AddForce
private void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) {
if (force.IsFinite())
{
float magnitude = force.Length();
if (magnitude > BSParam.MaxAddForceMagnitude)
{
// Force has a limit
force = force / magnitude * BSParam.MaxAddForceMagnitude;
}
OMV.Vector3 addForce = force;
// DetailLog("{0},BSCharacter.addForce,call,force={1}", LocalID, addForce);
PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.AddForce", delegate()
{
// Bullet adds this central force to the total force for this tick
// DetailLog("{0},BSCharacter.addForce,taint,force={1}", LocalID, addForce);
if (PhysBody.HasPhysicalBody)
{
PhysicsScene.PE.ApplyCentralForce(PhysBody, addForce);
}
});
}
else
{
m_log.WarnFormat("{0}: Got a NaN force applied to a character. LocalID={1}", LogHeader, LocalID);
return;
}
}
示例3: AddForce
public override void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) {
if (force.IsFinite())
{
OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude);
// DetailLog("{0},BSCharacter.addForce,call,force={1}", LocalID, addForce);
PhysScene.TaintedObject(inTaintTime, LocalID, "BSCharacter.AddForce", delegate()
{
// Bullet adds this central force to the total force for this tick
// DetailLog("{0},BSCharacter.addForce,taint,force={1}", LocalID, addForce);
if (PhysBody.HasPhysicalBody)
{
PhysScene.PE.ApplyCentralForce(PhysBody, addForce);
}
});
}
else
{
m_log.WarnFormat("{0}: Got a NaN force applied to a character. LocalID={1}", LogHeader, LocalID);
return;
}
}
示例4: AddForceImpulse
public void AddForceImpulse(OMV.Vector3 impulse, bool pushforce, bool inTaintTime) {
// for an object, doesn't matter if force is a pushforce or not
if (!IsPhysicallyActive)
{
if (impulse.IsFinite())
{
OMV.Vector3 addImpulse = Util.ClampV(impulse, BSParam.MaxAddForceMagnitude);
// DetailLog("{0},BSPrim.addForceImpulse,call,impulse={1}", LocalID, impulse);
PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.AddImpulse", delegate()
{
// Bullet adds this impulse immediately to the velocity
DetailLog("{0},BSPrim.addForceImpulse,taint,impulseforce={1}", LocalID, addImpulse);
if (PhysBody.HasPhysicalBody)
{
PhysScene.PE.ApplyCentralImpulse(PhysBody, addImpulse);
ActivateIfPhysical(false);
}
});
}
else
{
m_log.WarnFormat("{0}: AddForceImpulse: Got a NaN impulse applied to a prim. LocalID={1}", LogHeader, LocalID);
return;
}
}
}
示例5: AddAngularForce
// BSPhysObject.AddAngularForce()
public override void AddAngularForce(OMV.Vector3 force, bool pushforce, bool inTaintTime)
{
if (force.IsFinite())
{
OMV.Vector3 angForce = force;
PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.AddAngularForce", delegate()
{
if (PhysBody.HasPhysicalBody)
{
DetailLog("{0},BSPrim.AddAngularForce,taint,angForce={1}", LocalID, angForce);
PhysScene.PE.ApplyTorque(PhysBody, angForce);
ActivateIfPhysical(false);
}
});
}
else
{
m_log.WarnFormat("{0}: Got a NaN force applied to a prim. LocalID={1}", LogHeader, LocalID);
return;
}
}
示例6: AddAngularForce
public void AddAngularForce(OMV.Vector3 force, bool pushforce, bool inTaintTime)
{
if (force.IsFinite())
{
OMV.Vector3 angForce = force;
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddAngularForce", delegate()
{
if (PhysBody.HasPhysicalBody)
{
BulletSimAPI.ApplyTorque2(PhysBody.ptr, angForce);
ActivateIfPhysical(false);
}
});
}
else
{
m_log.WarnFormat("{0}: Got a NaN force applied to a prim. LocalID={1}", LogHeader, LocalID);
return;
}
}
示例7: 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) {
// for an object, doesn't matter if force is a pushforce or not
if (IsPhysicallyActive)
{
if (force.IsFinite())
{
// DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce);
OMV.Vector3 addForce = force;
PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.AddForce", delegate()
{
// Bullet adds this central force to the total force for this tick.
// Deep down in Bullet:
// linearVelocity += totalForce / mass * timeStep;
DetailLog("{0},BSPrim.addForce,taint,force={1}", LocalID, addForce);
if (PhysBody.HasPhysicalBody)
{
PhysScene.PE.ApplyCentralForce(PhysBody, addForce);
ActivateIfPhysical(false);
}
});
}
else
{
m_log.WarnFormat("{0}: AddForce: Got a NaN force applied to a prim. LocalID={1}", LogHeader, LocalID);
return;
}
}
}
示例8: 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 void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) {
// for an object, doesn't matter if force is a pushforce or not
if (force.IsFinite())
{
float magnitude = force.Length();
if (magnitude > 20000f)
{
// Force has a limit
force = force / magnitude * 20000f;
}
OMV.Vector3 addForce = force;
DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce);
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate()
{
// Bullet adds this central force to the total force for this tick
DetailLog("{0},BSPrim.addForce,taint,force={1}", LocalID, addForce);
if (PhysBody.HasPhysicalBody)
{
BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, addForce);
ActivateIfPhysical(false);
}
});
}
else
{
m_log.WarnFormat("{0}: Got a NaN force applied to a prim. LocalID={1}", LogHeader, LocalID);
return;
}
}
示例9: 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 void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime)
{
// for an object, doesn't matter if force is a pushforce or not
if (IsPhysicallyActive)
{
if (force.IsFinite())
{
// DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce);
OMV.Vector3 addForce = force;
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate()
{
// Bullet adds this central force to the total force for this tick
DetailLog("{0},BSPrim.addForce,taint,force={1}", LocalID, addForce);
if (PhysBody.HasPhysicalBody)
{
PhysicsScene.PE.ApplyCentralForce(PhysBody, addForce);
ActivateIfPhysical(false);
}
});
}
else
{
MainConsole.Instance.WarnFormat("{0}: AddForce: Got a NaN force applied to a prim. LocalID={1}", LogHeader, LocalID);
return;
}
}
}
示例10: AddForce
public override void AddForce(OMV.Vector3 force, bool pushforce) {
if (force.IsFinite())
{
_force.X += force.X;
_force.Y += force.Y;
_force.Z += force.Z;
// m_log.DebugFormat("{0}: AddForce. adding={1}, newForce={2}", LogHeader, force, _force);
PhysicsScene.TaintedObject("BSCharacter.AddForce", delegate()
{
DetailLog("{0},BSCharacter.setAddForce,taint,addedForce={1}", LocalID, _force);
BulletSimAPI.SetObjectForce2(BSBody.ptr, _force);
});
}
else
{
m_log.ErrorFormat("{0}: Got a NaN force applied to a Character", LogHeader);
}
//m_lastUpdateSent = false;
}
示例11: AddForce
public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) {
// for an object, doesn't matter if force is a pushforce or not
if (force.IsFinite())
{
// _force += force;
lock (m_accumulatedForces)
m_accumulatedForces.Add(new OMV.Vector3(force));
}
else
{
m_log.WarnFormat("{0}: Got a NaN force applied to a prim. LocalID={1}", LogHeader, LocalID);
return;
}
BSScene.TaintCallback addForceOperation = delegate()
{
OMV.Vector3 fSum = OMV.Vector3.Zero;
lock (m_accumulatedForces)
{
// Sum the accumulated additional forces for one big force to apply once.
foreach (OMV.Vector3 v in m_accumulatedForces)
{
fSum += v;
}
m_accumulatedForces.Clear();
}
// DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, fSum);
// For unknown reasons, "ApplyCentralForce" adds this force to the total force on the object.
BulletSimAPI.ApplyCentralForce2(BSBody.ptr, fSum);
};
if (inTaintTime)
addForceOperation();
else
PhysicsScene.TaintedObject("BSPrim.AddForce", addForceOperation);
}