public void GetBodies(out Body bodyA, out Body bodyB) { IntPtr a, b; __cpArbiterGetBodies (Handle.Handle, out a, out b); bodyA = new Body (a); bodyB = new Body (b); }
public void GetBodies(out Body bodyA, out Body bodyB) { IntPtr a, b; __cpArbiterGetBodies (Handle.Handle, out a, out b); bodyA = Body.FromIntPtr (a); bodyB = Body.FromIntPtr (b); }
public PolygonShape(Body body, float width, float height) : base(cpBoxShapeNew (body.Handle.Handle, width, height)) { }
public CircleShape(Body body, float radius, PointF offset) : base(cpCircleShapeNew (body.Handle.Handle, radius, offset)) { }
public void SleepWithGroup(Body group) { cpBodySleepWithGroup (Handle.Handle, group.Handle.Handle); }
public DampedSpring(Body bodyA, Body bodyB, PointF anchr1, PointF anchr2, float restLength, float stiffness, float damping) : base(cpDampedSpringNew (bodyA.Handle.Handle, bodyB.Handle.Handle, anchr1, anchr2, restLength, stiffness, damping)) { }
public RotaryLimitJoint(Body bodyA, Body bodyB, float min, float max) : base(cpRotaryLimitJointNew (bodyA.Handle.Handle, bodyB.Handle.Handle, min, max)) { }
public void Activate(Body body) { ActivateBody(body.Handle.Handle); }
public PivotJoint(Body bodyA, Body bodyB, PointF anchr1, PointF anchr2) : base(cpPivotJointNew2 (bodyA.Handle.Handle, bodyB.Handle.Handle, anchr1, anchr2)) { }
public RatchetJoint(Body bodyA, Body bodyB, float phase, float ratchet) : base(cpRatchetJointNew (bodyA.Handle.Handle, bodyB.Handle.Handle, phase, ratchet)) { }
public PivotJoint(Body bodyA, Body bodyB, PointF pivot) : base(cpPivotJointNew (bodyA.Handle.Handle, bodyB.Handle.Handle, pivot)) { }
public GrooveJoint(Body bodyA, Body bodyB, PointF grooveA, PointF grooveB, PointF anchr2) : base(cpGrooveJointNew (bodyA.Handle.Handle, bodyB.Handle.Handle, grooveA, grooveB, anchr2)) { }
public GearJoint(Body bodyA, Body bodyB, float phase, float ratio) : base(cpGearJointNew (bodyA.Handle.Handle, bodyB.Handle.Handle, phase, ratio)) { }
public PolygonShape(Body body, PointF[] vertices, PointF offset) : base(cpPolyShapeNew (body.Handle.Handle, vertices.Length, vertices, offset)) { }
public SimpleMotor(Body bodyA, Body bodyB, float rate) : base(cpSimpleMotorNew (bodyA.Handle.Handle, bodyB.Handle.Handle, rate)) { }
public SegmentShape(Body body, PointF a, PointF b, float radius) : base(cpSegmentShapeNew (body.Handle.Handle, a, b, radius)) { }
public SlideJoint(Body bodyA, Body bodyB, PointF anchr1, PointF anchr2, float min, float max) : base(cpSlideJointNew (bodyA.Handle.Handle, bodyB.Handle.Handle, anchr1, anchr2, min, max)) { }
void AddNewSpriteAt(PointF pos) { int posx, posy; var parent = GetChild(parentnode) as CCSpriteBatchNode; posx = (int)(rnd.NextDouble() * 200.0f); posy = (int)(rnd.NextDouble() * 200.0f); posx = (posx % 4) * 85; posy = (posy % 3) * 121; var sprite = new CCPhysicsSprite (parent.Texture, new RectangleF (posx, posy, 85, 121)); //this used to work, but crashes now, as it sets the Body's position and the Body isn't set yet :/ //sprite.Position = pos; parent.Add(sprite); PointF[] verts = { new PointF(-24,-54), new PointF(-24, 54), new PointF( 24, 54), new PointF( 24,-54), }; var body = new Body(1, Helper.MomentForPolygon(1f, verts, PointF.Empty)) {Position=pos}; space.Add(body); var shape = new PolygonShape(body, verts, PointF.Empty) { Elasticity = .5f, Friction =.5f }; space.Add(shape); sprite.Body = body; }
public DampedRotarySpring(Body bodyA, Body bodyB, float restAngle, float stiffness, float damping) : base(cpDampedRotarySpringNew (bodyA.Handle.Handle, bodyB.Handle.Handle, restAngle, stiffness, damping)) { }