本文整理汇总了C#中Box2DX.Dynamics.Body.GetXForm方法的典型用法代码示例。如果您正苦于以下问题:C# Body.GetXForm方法的具体用法?C# Body.GetXForm怎么用?C# Body.GetXForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box2DX.Dynamics.Body
的用法示例。
在下文中一共展示了Body.GetXForm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: limitVelocity
float limitVelocity(Body hull, float max)
{
Vec2 velocity = hull.GetLinearVelocityFromLocalPoint(Box2DX.Common.Vec2.Zero);
var vec1 = hull.GetXForm().R.Col2;
var projection = Vec2.Dot(velocity, vec1);
vec1 *= projection;
var A = vec1.Length();
if (A > max)
{
var k = max / A;
hull.SetLinearVelocity(vec1 * k);
}
return A;
}
示例2: PulleyJoint
public PulleyJoint(PulleyJointDef def)
: base(def)
{
_ground = _body1.GetWorld().GetGroundBody();
_groundAnchor1 = def.GroundAnchor1 - _ground.GetXForm().Position;
_groundAnchor2 = def.GroundAnchor2 - _ground.GetXForm().Position;
_localAnchor1 = def.LocalAnchor1;
_localAnchor2 = def.LocalAnchor2;
Box2DXDebug.Assert(def.Ratio != 0.0f);
_ratio = def.Ratio;
_constant = def.Length1 + _ratio * def.Length2;
_maxLength1 = Common.Math.Min(def.MaxLength1, _constant - _ratio * PulleyJoint.MinPulleyLength);
_maxLength2 = Common.Math.Min(def.MaxLength2, (_constant - PulleyJoint.MinPulleyLength) / _ratio);
_impulse = 0.0f;
_limitImpulse1 = 0.0f;
_limitImpulse2 = 0.0f;
}
示例3: killWheelOrthogonalVelocity
void killWheelOrthogonalVelocity(Body hull, Body wheel)
{
var p_hull = hull.GetPosition();
var p_wheel = wheel.GetPosition();
var velocity = wheel.GetLinearVelocityFromLocalPoint(Vec2.Zero);
var vec1 = wheel.GetXForm().R.Col1;
var projection = Vec2.Dot(velocity, vec1);
vec1 *= projection;
var k = vec1.Length() / 0.001f; // превышение боковой скорости 1 мм / с
if (k < 0.1f) k = 0.1f; if (k > 10f) k = 10f;
float force = -k * 3000; //warning - mn
vec1.Normalize();
hull.ApplyForce(force * vec1, p_wheel);
}