本文整理汇总了C#中Box2D.Common.Vec2类的典型用法代码示例。如果您正苦于以下问题:C# Vec2类的具体用法?C# Vec2怎么用?C# Vec2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vec2类属于Box2D.Common命名空间,在下文中一共展示了Vec2类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: WeldJointDef
public WeldJointDef()
{
type = JointType.WELD;
localAnchorA = new Vec2();
localAnchorB = new Vec2();
referenceAngle = 0.0f;
}
开发者ID:thdtjsdn,项目名称:box2dnet,代码行数:7,代码来源:WeldJointDef.cs
示例2: initialize
/// <summary>
/// Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis.
/// </summary>
public virtual void initialize(Body bA, Body bB, Vec2 anchor)
{
bodyA = bA;
bodyB = bB;
bA.getLocalPointToOut(anchor, localAnchorA);
bB.getLocalPointToOut(anchor, localAnchorB);
}
开发者ID:thdtjsdn,项目名称:box2dnet,代码行数:10,代码来源:FrictionJointDef.cs
示例3: ContactPositionConstraint
public ContactPositionConstraint()
{
for (int i = 0; i < LocalPoints.Length; i++)
{
LocalPoints[i] = new Vec2();
}
}
开发者ID:gerich-home,项目名称:box2dnet,代码行数:7,代码来源:ContactPositionConstraint.cs
示例4: Initialize
/// <summary>
/// Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis.
/// </summary>
public void Initialize(Body bA, Body bB, Vec2 anchor)
{
BodyA = bA;
BodyB = bB;
bA.GetLocalPointToOut(anchor, LocalAnchorA);
bB.GetLocalPointToOut(anchor, LocalAnchorB);
}
开发者ID:gerich-home,项目名称:box2dnet,代码行数:10,代码来源:FrictionJointDef.cs
示例5: WeldJointDef
public WeldJointDef()
{
Type = JointType.Weld;
LocalAnchorA = new Vec2();
LocalAnchorB = new Vec2();
ReferenceAngle = 0.0f;
}
开发者ID:gerich-home,项目名称:box2dnet,代码行数:7,代码来源:WeldJointDef.cs
示例6: FrictionJointDef
public FrictionJointDef()
{
Type = JointType.Friction;
LocalAnchorA = new Vec2();
LocalAnchorB = new Vec2();
MaxForce = 0f;
MaxTorque = 0f;
}
开发者ID:gerich-home,项目名称:box2dnet,代码行数:8,代码来源:FrictionJointDef.cs
示例7: FrictionJointDef
public FrictionJointDef()
{
type = JointType.FRICTION;
localAnchorA = new Vec2();
localAnchorB = new Vec2();
maxForce = 0f;
maxTorque = 0f;
}
开发者ID:thdtjsdn,项目名称:box2dnet,代码行数:8,代码来源:FrictionJointDef.cs
示例8: GetInitializedArray
protected internal Vec2[] GetInitializedArray(int argLength)
{
var ray = new Vec2[argLength];
for (int i = 0; i < ray.Length; i++)
{
ray[i] = new Vec2();
}
return ray;
}
开发者ID:gerich-home,项目名称:box2dnet,代码行数:9,代码来源:Vec2Array.cs
示例9: WorldManifold
public WorldManifold()
{
normal = new Vec2();
points = new Vec2[Settings.maxManifoldPoints];
for (int i = 0; i < Settings.maxManifoldPoints; i++)
{
points[i] = new Vec2();
}
}
开发者ID:thdtjsdn,项目名称:box2dnet,代码行数:9,代码来源:WorldManifold.cs
示例10: WorldManifold
public WorldManifold()
{
Normal = new Vec2();
Points = new Vec2[Settings.MAX_MANIFOLD_POINTS];
for (int i = 0; i < Settings.MAX_MANIFOLD_POINTS; i++)
{
Points[i] = new Vec2();
}
}
开发者ID:gerich-home,项目名称:box2dnet,代码行数:9,代码来源:WorldManifold.cs
示例11: Manifold
/// <summary> creates a manifold with 0 points, with it's points array full of instantiated ManifoldPoints.</summary>
public Manifold()
{
points = new ManifoldPoint[Settings.maxManifoldPoints];
for (int i = 0; i < Settings.maxManifoldPoints; i++)
{
points[i] = new ManifoldPoint();
}
localNormal = new Vec2();
localPoint = new Vec2();
pointCount = 0;
}
开发者ID:thdtjsdn,项目名称:box2dnet,代码行数:12,代码来源:Manifold.cs
示例12: PulleyJointDef
public PulleyJointDef()
{
Type = JointType.Pulley;
GroundAnchorA = new Vec2(-1.0f, 1.0f);
GroundAnchorB = new Vec2(1.0f, 1.0f);
LocalAnchorA = new Vec2(-1.0f, 0.0f);
LocalAnchorB = new Vec2(1.0f, 0.0f);
LengthA = 0.0f;
LengthB = 0.0f;
Ratio = 1.0f;
CollideConnected = true;
}
开发者ID:gerich-home,项目名称:box2dnet,代码行数:12,代码来源:PulleyJointDef.cs
示例13: FrictionJoint
/// <param name="argWorldPool"></param>
/// <param name="def"></param>
public FrictionJoint(IWorldPool argWorldPool, FrictionJointDef def)
: base(argWorldPool, def)
{
m_localAnchorA = new Vec2(def.localAnchorA);
m_localAnchorB = new Vec2(def.localAnchorB);
m_linearImpulse = new Vec2();
m_angularImpulse = 0.0f;
m_maxForce = def.maxForce;
m_maxTorque = def.maxTorque;
}
开发者ID:thdtjsdn,项目名称:box2dnet,代码行数:14,代码来源:FrictionJoint.cs
示例14: PulleyJointDef
public PulleyJointDef()
{
type = JointType.PULLEY;
groundAnchorA = new Vec2(-1.0f, 1.0f);
groundAnchorB = new Vec2(1.0f, 1.0f);
localAnchorA = new Vec2(-1.0f, 0.0f);
localAnchorB = new Vec2(1.0f, 0.0f);
lengthA = 0.0f;
lengthB = 0.0f;
ratio = 1.0f;
collideConnected = true;
}
开发者ID:thdtjsdn,项目名称:box2dnet,代码行数:12,代码来源:PulleyJointDef.cs
示例15: PolygonShape
public PolygonShape()
: base(ShapeType.Polygon)
{
VertexCount = 0;
Vertices = new Vec2[Settings.MAX_POLYGON_VERTICES];
for (int i = 0; i < Vertices.Length; i++)
{
Vertices[i] = new Vec2();
}
Normals = new Vec2[Settings.MAX_POLYGON_VERTICES];
for (int i = 0; i < Normals.Length; i++)
{
Normals[i] = new Vec2();
}
Radius = Settings.POLYGON_RADIUS;
Centroid.SetZero();
}
开发者ID:gerich-home,项目名称:box2dnet,代码行数:17,代码来源:PolygonShape.cs
示例16: Main
static void Main(string[] args)
{
// Static Body
Vec2 gravity = new Vec2(0, -10);
bool doSleep = true;
World world = new World(gravity);
world.SleepingAllowed = doSleep;
BodyDef groundBodyDef = new BodyDef();
groundBodyDef.position.set_Renamed(0, -10);
Body groundBody = world.createBody(groundBodyDef);
PolygonShape groundBox = new PolygonShape();
groundBox.setAsBox(50, 10);
groundBody.createFixture(groundBox, 0);
// Dynamic Body
BodyDef bodyDef = new BodyDef();
bodyDef.type = BodyType.DYNAMIC;
bodyDef.position.set_Renamed(0, 4);
Body body = world.createBody(bodyDef);
PolygonShape dynamicBox = new PolygonShape();
dynamicBox.setAsBox(1, 1);
FixtureDef fixtureDef = new FixtureDef();
fixtureDef.shape = dynamicBox;
fixtureDef.density = 1;
fixtureDef.friction = 0.3f;
body.createFixture(fixtureDef);
// Setup world
float timeStep = 1.0f / 60.0f;
int velocityIterations = 6;
int positionIterations = 2;
// Run loop
for (int i = 0; i < 60; ++i)
{
world.step(timeStep, velocityIterations, positionIterations);
Vec2 position = body.Position;
float angle = body.Angle;
Console.WriteLine("{0:0.00} {1:0.00} {2:0.00}", position.x, position.y, angle);
}
}
开发者ID:thdtjsdn,项目名称:box2dnet,代码行数:41,代码来源:Program.cs
示例17: getAnchorB
public override void getAnchorB(Vec2 argOut)
{
m_bodyB.getWorldPointToOut(m_localAnchorB, argOut);
}
开发者ID:thdtjsdn,项目名称:box2dnet,代码行数:4,代码来源:PrismaticJoint.cs
示例18: PrismaticJoint
public PrismaticJoint(IWorldPool argWorld, PrismaticJointDef def)
: base(argWorld, def)
{
m_localAnchorA = new Vec2(def.localAnchorA);
m_localAnchorB = new Vec2(def.localAnchorB);
m_localXAxisA = new Vec2(def.localAxisA);
m_localXAxisA.normalize();
m_localYAxisA = new Vec2();
Vec2.crossToOutUnsafe(1f, m_localXAxisA, m_localYAxisA);
m_referenceAngle = def.referenceAngle;
m_impulse = new Vec3();
m_motorMass = 0.0f;
m_motorImpulse = 0.0f;
m_lowerTranslation = def.lowerTranslation;
m_upperTranslation = def.upperTranslation;
m_maxMotorForce = def.maxMotorForce;
m_motorSpeed = def.motorSpeed;
m_enableLimit = def.enableLimit;
m_enableMotor = def.enableMotor;
m_limitState = LimitState.INACTIVE;
m_K = new Mat33();
m_axis = new Vec2();
m_perp = new Vec2();
}
开发者ID:thdtjsdn,项目名称:box2dnet,代码行数:27,代码来源:PrismaticJoint.cs
示例19: getReactionForce
public override void getReactionForce(float inv_dt, Vec2 argOut)
{
argOut.set_Renamed(m_uB).mulLocal(m_impulse).mulLocal(inv_dt);
}
开发者ID:thdtjsdn,项目名称:box2dnet,代码行数:4,代码来源:PulleyJoint.cs
示例20: raycast
/// <summary>
/// Ray-cast the world for all fixtures in the path of the ray. Your callback controls whether you
/// get the closest point, any point, or n-points. The ray-cast ignores shapes that contain the
/// starting point.
/// </summary>
/// <param name="callback">a user implemented callback class.</param>
/// <param name="point1">the ray starting point</param>
/// <param name="point2">the ray ending point</param>
public virtual void raycast(RayCastCallback callback, Vec2 point1, Vec2 point2)
{
wrcwrapper.broadPhase = m_contactManager.m_broadPhase;
wrcwrapper.callback = callback;
input.maxFraction = 1.0f;
input.p1.set_Renamed(point1);
input.p2.set_Renamed(point2);
m_contactManager.m_broadPhase.raycast(wrcwrapper, input);
}
开发者ID:thdtjsdn,项目名称:box2dnet,代码行数:17,代码来源:World.cs
注:本文中的Box2D.Common.Vec2类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论