Ejemplo n.º 1
0
        public override void Update(float dt)
        {
            base.Update(dt);

            if (CCMouse.Instance.rightclick)
            {
                cpPointQueryInfo info    = null;
                cpShape          nearest = space.PointQueryNearest(CCMouse.Instance.Position, 0.0f, GRAB_FILTER, ref info);
                if (nearest != null)
                {
                    cpBody body = nearest.GetBody();                    // cpShapeGetBody();
                    if (body.bodyType == cpBodyType.STATIC)
                    {
                        body.SetBodyType(cpBodyType.DYNAMIC);
                        body.SetMass(pentagon_mass);
                        body.SetMoment(pentagon_moment);
                    }
                    else if (body.bodyType == cpBodyType.DYNAMIC)
                    {
                        body.SetBodyType(cpBodyType.STATIC);
                    }
                }
            }



            space.EachBody(eachBody, null);

            space.Step(dt);
        }