本文整理汇总了C#中FarseerPhysics.Dynamics.Body.GetWorldVector方法的典型用法代码示例。如果您正苦于以下问题:C# Body.GetWorldVector方法的具体用法?C# Body.GetWorldVector怎么用?C# Body.GetWorldVector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FarseerPhysics.Dynamics.Body
的用法示例。
在下文中一共展示了Body.GetWorldVector方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateBullets
private static void CreateBullets(Body ship)
{
Func<Vector2, Body> createBullet = pos =>
{
var body = new Body(world);
body.BodyType = BodyType.Dynamic;
body.IsBullet = true;
var shape = new FarseerCircleShape(0.15f / 4, 1);
body.CreateFixture(shape);
body.Position = ship.Position + ship.GetWorldVector(pos);
body.Rotation = ship.Rotation;
body.ApplyForce(body.GetWorldVector(new Vector2(0.0f, -15f)));
body.OnCollision += (a, b, contact) =>
{
world.RemoveBody(body);
return false;
};
return body;
};
createBullet(new Vector2(-0.575f, -0.20f));
createBullet(new Vector2(0.575f, -0.20f));
}
示例2: CreateBullets
private void CreateBullets()
{
Func<Vector2, Body> createBullet = pos =>
{
var body = new Body(Game.World);
body.BodyType = BodyType.Dynamic;
body.IsBullet = true;
body.UserData = new RadarData(RadarType.Bullet, new NetBullet(body));
var shape = new CircleShape(0.15f / 4, 1);
body.CreateFixture(shape);
body.Position = Body.Position + Body.GetWorldVector(pos);
body.Rotation = Body.Rotation;
body.ApplyForce(body.GetWorldVector(new Vector2(0.0f, -10f)));
body.OnCollision += (a, b, contact) =>
{
Game.World.RemoveBody(body);
return false;
};
return body;
};
createBullet(new Vector2(-0.575f, -0.20f));
createBullet(new Vector2(0.575f, -0.20f));
}