/// <summary> /// Attach a fixture to this shape. /// </summary> /// <param name="def">The fixture definition to add.</param> /// <returns>The created Fixture object.</returns> public Fixture CreateFixture(FixtureDef def) { def.SetShape(def.Shape.Lock()); Fixture fixture; using (var structPtr = new StructToPtrMarshaller(def.Internal)) fixture = Fixture.FromPtr(NativeMethods.b2body_createfixture(_bodyPtr, structPtr.Pointer)); def.Shape.Unlock(); return(fixture); }
public Joint CreateJoint(JointDef def) { using (var ptr = new StructToPtrMarshaller(def)) return(Joint.FromPtr(NativeMethods.b2world_createjoint(_worldPtr, ptr.Pointer))); }
public Body CreateBody(BodyDef def) { using (var structPtr = new StructToPtrMarshaller(def)) return(Body.FromPtr(NativeMethods.b2world_createbody(_worldPtr, structPtr.Pointer))); }
internal override void Unlock() { _internalstruct.Free(); _internalstruct = null; }
internal override IntPtr Lock() { _internalCircleShape.m_shape = base.InternalShape; _internalstruct = new StructToPtrMarshaller(_internalCircleShape); return(_internalstruct.Pointer); }