本文整理汇总了C#中Game.Orig.Math3D.MyVector.Multiply方法的典型用法代码示例。如果您正苦于以下问题:C# MyVector.Multiply方法的具体用法?C# MyVector.Multiply怎么用?C# MyVector.Multiply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game.Orig.Math3D.MyVector
的用法示例。
在下文中一共展示了MyVector.Multiply方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCollisionNormalAndPointsOfContact_SphereSphere
protected void GetCollisionNormalAndPointsOfContact_SphereSphere(out MyVector normal, out double normalMagnitude, out MyVector pointOfContact1, out MyVector pointOfContact2, BallBlip ball1, BallBlip ball2)
{
// Vector that is perpendicular to the tangent of the collision, and it points in the direction of object 1. Real
// easy when dealing with spheres :)
normal = ball2.Ball.Position - ball1.Ball.Position;
// Remember this length
normalMagnitude = normal.GetMagnitude();
// This needs to be returned as a unit vector
normal.Divide(normalMagnitude);
// Start them off as unit vectors
pointOfContact1 = normal.Clone();
pointOfContact2 = normal.Clone();
// Finish (use the ratio of their radii)
pointOfContact1.Multiply((ball1.Ball.Radius / (ball1.Ball.Radius + ball2.Ball.Radius)) * normalMagnitude);
pointOfContact2.Multiply((ball2.Ball.Radius / (ball1.Ball.Radius + ball2.Ball.Radius)) * normalMagnitude * -1); // I want this one pointing the other direction
// Now that I have the points of contact relative to the centers of position, I need to make them
// relative to the centers of mass
if (ball1.TorqueBall != null)
{
pointOfContact1.Subtract(ball1.TorqueBall.CenterOfMass);
}
if (ball2.TorqueBall != null)
{
pointOfContact2.Subtract(ball2.TorqueBall.CenterOfMass);
}
}
示例2: StoreMouseMove
private void StoreMouseMove(int x, int y)
{
MyVector safe = new MyVector();
safe.X = UtilityCore.GetScaledValue(_multiplier * -1d, _multiplier, 0, this.Width, x);
safe.Y = UtilityCore.GetScaledValue(_multiplier * -1d, _multiplier, 0, this.Height, y);
double safeMultiplier = _multiplier * SAFEPERCENT; // I don't want to butt up against the multiplier, or store value will increase it on me
if (safe.GetMagnitudeSquared() > safeMultiplier * safeMultiplier)
{
safe.BecomeUnitVector();
safe.Multiply(safeMultiplier);
}
StoreNewValue(safe.X, safe.Y, 0d);
}