Examples of RigidBody


Examples of aspect.physics.RigidBody

            0, 0, 50, 0
        };
       
        //addComponent(new VBOModel2D(LINES, vertices, colors(color, 2)));
        addBehavior(ellipse(color, 16, 16, 10));
        addBehavior(new RigidBody());
       
        cohesion = new Cohesion(this, Boids.BOID_COHESION, IntensityModel.INVERSE);
        alignment = new Alignment(this, Boids.BOID_ALIGNMENT, IntensityModel.INVERSE);
        separation = new Cohesion(this, -Boids.BOID_SEPARATION, IntensityModel.INVERSE_SQUARE);
       
        pos.x = getCanvasWidth() * (float)Math.random();
        pos.y = getCanvasHeight() * (float)Math.random();
       
        RigidBody rb = rigidBody();
       
        rb.vel = Vector2.fromAngle((float)Math.random() * 360, 200).asXY();
       
       
        addBehavior(new Behavior() {
            @Override
            public void update() {
                RigidBody rb = ent.rigidBody();
                if (ent.pos.x > getCanvasWidth() || ent.pos.x < 0) {
                    rb.vel.x *= -1;
                }
               
                if (ent.pos.y > getCanvasHeight() || ent.pos.y < 0) {
View Full Code Here

Examples of aspect.physics.RigidBody

            angle += 90 * Time.deltaTime();
        }
        ship.ang.roll = -ship.rigidBody().velocity.xy().dir() - angle;

        if (thrusters) {
            RigidBody rb = ship.rigidBody();
            rb.impel(Vector2.fromAngle(-ship.ang.roll, 60e3f).asXY());
        }

        if (Vector3.distance(ship.pos, earth.pos) < 90 || Vector3.distance(ship.pos, moon.pos) < 70) {
            //onAdd();
        }
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

        MotionState groundMotionState = new DefaultMotionState(new Transform(new Matrix4f(
                new Quat4f(0, 0, 0, 1),
                new Vector3f(0, 0, 0), 1.0f)));
        RigidBodyConstructionInfo groundBodyConstructionInfo = new RigidBodyConstructionInfo(0, groundMotionState, groundShape, new Vector3f(0, 0, 0));
        groundBodyConstructionInfo.restitution = 0.25f;
        RigidBody groundRigidBody = new RigidBody(groundBodyConstructionInfo);
        dynamicsWorld.addRigidBody(groundRigidBody);
        MotionState ballMotionState = new DefaultMotionState(DEFAULT_BALL_TRANSFORM);
        Vector3f ballInertia = new Vector3f(0, 0, 0);
        ballShape.calculateLocalInertia(2.5f, ballInertia);
        RigidBodyConstructionInfo ballConstructionInfo = new RigidBodyConstructionInfo(2.5f, ballMotionState, ballShape, ballInertia);
        ballConstructionInfo.restitution = 0.5f;
        ballConstructionInfo.angularDamping = 0.95f;
        controlBall = new RigidBody(ballConstructionInfo);
        controlBall.setActivationState(CollisionObject.DISABLE_DEACTIVATION);
        balls.add(controlBall);
        dynamicsWorld.addRigidBody(controlBall);
    }
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

            DefaultMotionState motionState = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(camera.x(), 35, camera.z()), 1)));
            Vector3f inertia = new Vector3f();
            shape.calculateLocalInertia(1.0f, inertia);
            RigidBodyConstructionInfo constructionInfo = new RigidBodyConstructionInfo(1.0f, motionState, shape, inertia);
            constructionInfo.restitution = 0.75f;
            RigidBody body = new RigidBody(constructionInfo);
            dynamicsWorld.addRigidBody(body);
            balls.add(body);
            createNewShape = false;
        }
        if (resetControlBall) {
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

            this.radius = radius;
            this.slices = slices;
            this.stacks = stacks;
            MotionState motion = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), position, 1.0f)));
            CollisionShape shape = new SphereShape(radius);
            this.physicsBody = new RigidBody(mass, motion, shape);
            this.physicsWorld = physicsWorld;
            this.physicsWorld.addRigidBody(physicsBody);
            this.renderSphere = new org.lwjgl.util.glu.Sphere();
        }
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

        // Set the restitution, also known as the bounciness or spring, to 0.25. The restitution may range from 0.0
        // not bouncy) to 1.0 (extremely bouncy).
        groundBodyConstructionInfo.restitution = 0.25f;
        // Initialise 'groundRigidBody', the final variable representing the ground, to a rigid body with the previously
        // assigned construction information.
        RigidBody groundRigidBody = new RigidBody(groundBodyConstructionInfo);
        // Add the ground to the JBullet world.
        dynamicsWorld.addRigidBody(groundRigidBody);
        // Initialise 'ballMotion' to a motion state that assigns a specified location to the ball.
        MotionState ballMotion = new DefaultMotionState(new Transform(DEFAULT_BALL_TRANSFORM));
        // Calculate the ball's inertia (resistance to movement) using its mass (2.5 kilograms).
        Vector3f ballInertia = new Vector3f(0, 0, 0);
        ballShape.calculateLocalInertia(2.5f, ballInertia);
        // Composes the ball's construction info of its mass, its motion state, its shape, and its inertia.
        RigidBodyConstructionInfo ballConstructionInfo = new RigidBodyConstructionInfo(2.5f, ballMotion, ballShape, ballInertia);
        // Set the restitution, also known as the bounciness or spring, to 0.5. The restitution may range from 0.0
        // not bouncy) to 1.0 (extremely bouncy).
        ballConstructionInfo.restitution = 0.5f;
        ballConstructionInfo.angularDamping = 0.95f;
        // Initialise 'controlBall', the final variable representing the controlled ball, to a rigid body with the
        // previously assigned construction information.
        controlBall = new RigidBody(ballConstructionInfo);
        // Disable 'sleeping' for the controllable ball.
        controlBall.setActivationState(CollisionObject.DISABLE_DEACTIVATION);
        // Add the control ball to the set of balls (more may be added by pressing 'g').
        balls.add(controlBall);
        // Add the control ball to the JBullet world.
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

            // Calculate the inertia (resistance to movement) using the ball's mass of 1 kilogram.
            Vector3f inertia = new Vector3f(0, 0, 0);
            shape.calculateLocalInertia(1.0f, inertia);
            RigidBodyConstructionInfo constructionInfo = new RigidBodyConstructionInfo(1, motionState, shape, inertia);
            constructionInfo.restitution = 0.75f;
            RigidBody rigidBody = new RigidBody(constructionInfo);
            balls.add(rigidBody);
            dynamicsWorld.addRigidBody(rigidBody);
            createNewShape = false;
        }
        // If the controllable ball's position and orientation should be reset ...
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

            this.radius = radius;
            this.slices = slices;
            this.stacks = stacks;
            MotionState motion = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), position, 1.0f)));
            CollisionShape shape = new SphereShape(radius);
            this.physicsBody = new RigidBody(mass, motion, shape);
            this.physicsWorld = physicsWorld;
            this.physicsWorld.addRigidBody(physicsBody);
            this.renderSphere = new org.lwjgl.util.glu.Sphere();
        }
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

        startTransform);

    this.startWorldTransform = startTransform;
    RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(mass,
        myMotionState, trimesh, localInertia);
    rigidBody = new RigidBody(rbInfo);
    Transform center = new Transform();
    center.origin.set(centreOfMass.x, centreOfMass.y, centreOfMass.z);
    rigidBody.setCenterOfMassTransform(center);

    rigidBody.setDamping(SETTINGS.chair_damping_linear,
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

    }
  }

  boolean mouseOver(float mouseX, float mouseY) {

    RigidBody selectedBod = GLOBAL.jBullet.getOver(mouseX, mouseY);

    if (selectedBod != null && this.rigidBody != null
        && this.rigidBody.equals(selectedBod)) {
      return true;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.