Package aspect.entity

Examples of aspect.entity.Entity.rigidBody()


            float tick = 5f;
            boolean readyToStop = false;
            for (float t = 0; t < 8000; t += tick) {
                Entity e = new Entity();
                e.addBehavior(new RigidBody(curVel, Vector3.zero()));
                e.rigidBody().addForce(moonGravity);
                e.rigidBody().addForce(earthGravity);
                e.pos = curPos;
                Vector3 realAcc = rb.acceleration.plus(Vector3.divide(e.rigidBody().netForce(), e.rigidBody().mass));
                Vector3 velOld = curVel;
                curVel = curVel.plus(realAcc.times(tick));
View Full Code Here


            boolean readyToStop = false;
            for (float t = 0; t < 8000; t += tick) {
                Entity e = new Entity();
                e.addBehavior(new RigidBody(curVel, Vector3.zero()));
                e.rigidBody().addForce(moonGravity);
                e.rigidBody().addForce(earthGravity);
                e.pos = curPos;
                Vector3 realAcc = rb.acceleration.plus(Vector3.divide(e.rigidBody().netForce(), e.rigidBody().mass));
                Vector3 velOld = curVel;
                curVel = curVel.plus(realAcc.times(tick));
                curPos = curPos.plus(Vector3.multiply(Vector3.add(Vector3.multiply(velOld, tick), Vector3.multiply(curVel, tick)), 0.5f));
View Full Code Here

                Entity e = new Entity();
                e.addBehavior(new RigidBody(curVel, Vector3.zero()));
                e.rigidBody().addForce(moonGravity);
                e.rigidBody().addForce(earthGravity);
                e.pos = curPos;
                Vector3 realAcc = rb.acceleration.plus(Vector3.divide(e.rigidBody().netForce(), e.rigidBody().mass));
                Vector3 velOld = curVel;
                curVel = curVel.plus(realAcc.times(tick));
                curPos = curPos.plus(Vector3.multiply(Vector3.add(Vector3.multiply(velOld, tick), Vector3.multiply(curVel, tick)), 0.5f));
                glVertex2f(curPos.x, curPos.y);
View Full Code Here

                Entity e = new Entity();
                e.addBehavior(new RigidBody(curVel, Vector3.zero()));
                e.rigidBody().addForce(moonGravity);
                e.rigidBody().addForce(earthGravity);
                e.pos = curPos;
                Vector3 realAcc = rb.acceleration.plus(Vector3.divide(e.rigidBody().netForce(), e.rigidBody().mass));
                Vector3 velOld = curVel;
                curVel = curVel.plus(realAcc.times(tick));
                curPos = curPos.plus(Vector3.multiply(Vector3.add(Vector3.multiply(velOld, tick), Vector3.multiply(curVel, tick)), 0.5f));
                glVertex2f(curPos.x, curPos.y);
View Full Code Here

    public static Entity box(Material material, float width, float height, float depth, float density) {
        Entity entity = new Entity(Resources.box(material, width, height, depth));
        entity.addBehavior(Collider.box(width, height, depth));
        entity.addBehavior(new RigidBody());

        entity.rigidBody().mass = width * height * depth * density;

        float w2 = width * width;
        float h2 = height * height;
        float d2 = depth * depth;

 
View Full Code Here

        float w2 = width * width;
        float h2 = height * height;
        float d2 = depth * depth;

        float f = entity.rigidBody().mass / 12.0f;

        entity.rigidBody().setMomentsOfInertia(new Vector3(f * (h2 + d2), f * (w2 + d2), f * (w2 + h2)));

        return entity;
    }
View Full Code Here

        float h2 = height * height;
        float d2 = depth * depth;

        float f = entity.rigidBody().mass / 12.0f;

        entity.rigidBody().setMomentsOfInertia(new Vector3(f * (h2 + d2), f * (w2 + d2), f * (w2 + h2)));

        return entity;
    }
}
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.