本文整理汇总了C#中OpenMetaverse.Length方法的典型用法代码示例。如果您正苦于以下问题:C# OpenMetaverse.Length方法的具体用法?C# OpenMetaverse.Length怎么用?C# OpenMetaverse.Length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenMetaverse
的用法示例。
在下文中一共展示了OpenMetaverse.Length方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
示例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: ProcessEntityAnimation
// For the moment, create only one animation for an entity and that is the angular rotation.
private void ProcessEntityAnimation(IEntity ent, ref UpdateCodes updateFlags, OMV.Vector3 angularVelocity)
{
try {
// if there is an angular velocity and this is not an avatar, pass the information
// along as an animation (llTargetOmega)
// we convert the information into a standard form
IEntityAvatar av;
if (angularVelocity != OMV.Vector3.Zero) {
if (!ent.TryGet<IEntityAvatar>(out av)) {
float rotPerSec = angularVelocity.Length() / Constants.TWOPI;
OMV.Vector3 axis = angularVelocity;
axis.Normalize();
IAnimation anim;
if (!ent.TryGet<IAnimation>(out anim)) {
anim = new LLAnimation();
ent.RegisterInterface<IAnimation>(anim);
m_log.Log(LogLevel.DUPDATEDETAIL, "Created prim animation on {0}", ent.Name);
}
if (rotPerSec != anim.StaticRotationRotPerSec || axis != anim.StaticRotationAxis) {
anim.AngularVelocity = angularVelocity; // legacy. Remove when other part plumbed
anim.StaticRotationAxis = axis;
anim.StaticRotationRotPerSec = rotPerSec;
anim.DoStaticRotation = true;
updateFlags |= UpdateCodes.Animation;
m_log.Log(LogLevel.DUPDATEDETAIL, "Updating prim animation on {0}", ent.Name);
}
}
}
}
catch (Exception e) {
m_log.Log(LogLevel.DBADERROR, "FAILED ProcessEntityAnimation: " + e.ToString());
}
}