示例#1
0
        private void drawTimer_Tick(object sender, EventArgs e)
        {
            if (followMouse)
            {
                wheel1.AddAngularVelocity(-.01F, isMomentum: false);
                wheel2.AddAngularVelocity(-.01F, isMomentum: false);
            }

            handler.Update(null);
            Invalidate();
        }
示例#2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //handler.AddMetaElement(new GlobalFrictionMeta(.001F));
            handler.AddMetaElement(new GravityMeta());

            bound = new RigidBody(new RotationRectangle(new ImpulseEngine2.RectangleF(0, Height * (2F / 3), Width, Height / 3)), DefinedMaterials.Static);
            handler.AddBody(bound);

            RigidBody sampleBody = new RigidBody(new RotationRectangle(new ImpulseEngine2.RectangleF(Width / 3, 100, Width / 3, Height / 3)), DefinedMaterials.Wood);
            //sampleBody.AddTranslationalVelocity(new Vector2(1, 0), isMomentum: false);
            //sampleBody.AddAngularVelocity(.1F, isMomentum: false);

            RigidBody sampleBody2 = new RigidBody(new RotationRectangle(new ImpulseEngine2.RectangleF(0, Height / 3, Width / 5, Height / 5)), DefinedMaterials.Wood);

            sampleBody2.AddAngularVelocity(.1F, isMomentum: false);

            RigidBody sampleBody3 = new RigidBody(new RotationRectangle(new ImpulseEngine2.RectangleF(Width * (4F / 5), Height / 3, Width / 5, Height / 5)), DefinedMaterials.Wood);

            sampleBody3.AddAngularVelocity(.1F, isMomentum: false);

            handler.AddBody(sampleBody);
            //handler.AddBody(sampleBody2);
            //handler.AddBody(sampleBody3);
        }