本文整理汇总了C#中OpenMetaverse.Vector3.LengthSquared方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.LengthSquared方法的具体用法?C# Vector3.LengthSquared怎么用?C# Vector3.LengthSquared使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenMetaverse.Vector3
的用法示例。
在下文中一共展示了Vector3.LengthSquared方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecayForces
private void DecayForces(float secondsSinceLastSync)
{
if (_vForces != OpenMetaverse.Vector3.Zero) // Do I have any forces to decay?
{
if (_vTarget != OpenMetaverse.Vector3.Zero) // Has user input?
{
if (!_flying)
{
//user movement instantly cancels any x or y axis movement, but
//it does not cancel z axis movement while jumping. This allows the user to have
//a nice jump while walking
_vForces.X = 0f;
_vForces.Y = 0f;
}
else
{
_vForces = OpenMetaverse.Vector3.Zero;
}
}
else // No user input found.
{
//decay velocity in relation to velocity to badly mimic drag
OpenMetaverse.Vector3 decayForce;
if (_collidingGround)
{
decayForce = OpenMetaverse.Vector3.Multiply(_vForces, 2.0f * secondsSinceLastSync);
}
else
{
decayForce = OpenMetaverse.Vector3.Multiply(_vForces, 1.0f * secondsSinceLastSync);
}
_vForces -= decayForce;
if (_vForces.LengthSquared() < MIN_FORCE_MAG_BEFORE_ZEROING_SQUARED)
{
_vForces = OpenMetaverse.Vector3.Zero;
}
}
}
}