本文整理汇总了C#中Body.GetAbsoluteLocation方法的典型用法代码示例。如果您正苦于以下问题:C# Body.GetAbsoluteLocation方法的具体用法?C# Body.GetAbsoluteLocation怎么用?C# Body.GetAbsoluteLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Body
的用法示例。
在下文中一共展示了Body.GetAbsoluteLocation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoggingObject
public LoggingObject(Body pb, Body root)
{
Body = pb;
_root = root;
InitialLocation = pb.GetAbsoluteLocation();
_lastLocation = InitialLocation.NewX(InitialLocation.X + 1);
_lastVisibility = !IsVisible();
}
示例2: AbsoluteLocationLinear
public void AbsoluteLocationLinear()
{
var root = new Body {Location = new Frame3D(0, 0, 10)};
Assert.AreEqual(root.Location, root.GetAbsoluteLocation());
var box = new Box {Location = new Frame3D(10, 0, 0)};
Assert.AreEqual(box.Location, box.GetAbsoluteLocation());
root.Add(box);
Assert.AreEqual(box.Location.Apply(root.Location), box.GetAbsoluteLocation());
int sum = 0;
for(int i = 0; i < 10; i++)
{
sum += i;
Body child = new Box {Location = new Frame3D(i, 0, 0)};
root.Add(child);
Assert.AreEqual(sum, child.GetAbsoluteLocation().X);
root = child;
}
}
示例3: MoveAndCheck
private static void MoveAndCheck(LoggingObject lo, Body box)
{
for(int i = 0; i < 5; i++)
{
box.Location = box.Location.Apply(new Frame3D(1, 1, 0));
lo.SaveLocation(box.GetAbsoluteLocation(), _totalTime);
Frame3D loc = lo.Movements.Last().NextLocation();
Assert.AreEqual(box.GetAbsoluteLocation(), loc);
}
Assert.AreEqual(_totalTime, lo.Movements[_movementCount].StartTime);
_totalTime += 0.1;
_movementCount++;
Assert.AreEqual(_movementCount, lo.Movements.Count);
}
示例4: CaptureDevicet
private void CaptureDevicet(Body box, Body newChild)
{
var childAbsolute = newChild.GetAbsoluteLocation();
if (newChild.Parent != null)
newChild.Parent.Remove(newChild);
newChild.Location = box.GetAbsoluteLocation().Invert().Apply(childAbsolute);
newChild.Location = newChild.Location.NewYaw(Angle.Zero);
newChild.Location = newChild.Location.NewX(14);
newChild.Location = newChild.Location.NewY(0);
frictionCoefficientsById.SafeAdd(newChild.Id, newChild.FrictionCoefficient);
newChild.FrictionCoefficient = 0;
box.Add(newChild);
}
示例5: Distance
private double Distance(Body from, Body to)
{
return Geometry.Hypot(from.GetAbsoluteLocation() - to.GetAbsoluteLocation());
}