Package aspect.util

Examples of aspect.util.Vector3


           
            @Override
            public void render() {
                loadIdentity();
                begin(LINES);
                Vector3 force = ent.rigidBody().netForce();
                Vector3 vel = ent.rigidBody().vel.normalize().times(50);
                /*
                color(Color.RED);
                vertex(ent.pos.xy());
                vertex(ent.pos.plus(force).xy());*/
                color(Color.BLUE);
View Full Code Here


    public Vector3 getForce(Entity ent2) {
        if (ent2 == ent) {
            return Vector3.zero();
        }
       
        Vector3 cur = ent2.rigidBody().vel.normalize();
        Vector3 dest = ent.rigidBody().vel.normalize();
        Vector3 cross = Vector3.cross(cur, dest).normalize();
       
        Vector3 direction = Matrix4x4.identity().rotate(cross, -90).apply(cur);
        float magnitude = model.multiplier(Vector3.distance(ent.pos, ent2.pos)) * Trig.sin(Vector3.angleBetween(cur, dest)) * strength;
       
        if (magnitude == Float.NaN) {
            return Vector3.zero();
        }
       
        return direction.times(magnitude);
    }
View Full Code Here

    public Vector3 getForce(Entity ent2) {
        if (ent2 == ent) {
            return Vector3.zero();
        }
       
        Vector3 cur = ent2.rigidBody().vel.normalize();
        Vector3 dest = ent.pos.minus(ent2.pos).normalize();
        Vector3 cross = Vector3.cross(dest, cur);
        Vector3 direction = Matrix4x4.identity().rotate(cross, 90).apply(cur);
        float magnitude = model.multiplier(Vector3.distance(ent.pos, ent2.pos)) * Trig.sin(Vector3.angleBetween(cur, dest)) * strength;
        return direction.times(magnitude);
    }
View Full Code Here

       
        centerMouse();
    }

    public void cam() {
        Vector3 up = rot.applyRotation(Vector3.yAxis());
        Vector3 forward = rot.applyRotation(Vector3.zAxis().negate());

        //GLU.gluLookAt(0, 0, 0, forward.x, forward.y, forward.z, up.x, up.y, up.z);
        transform(rot.invert());
        translate(pos.negate());
View Full Code Here

    private class ShipControl extends Behavior {

        @Override
        public void update() {
            Vector3 up = Vector3.yAxis();
            Vector3 right = Vector3.xAxis();
            Vector3 forward = Vector3.zAxis().negate();

            Motion m = getBehavior(Motion.class);
           
            float yaw = -getMouseDX() * mouseSensitivity;
            float pitch = getMouseDY() * mouseSensitivity;
           
            if (isKeyDown(KEY_UP)) {
                pitch += 50;
            }
           
            if (isKeyDown(KEY_DOWN)) {
                pitch -= 50;
            }
           
            if (isKeyDown(KEY_LEFT)) {
                yaw += 50;
            }
           
            if (isKeyDown(KEY_RIGHT)) {
                yaw -= 50;
            }
           
            yaw = Math.min(Math.abs(yaw), 120) * Math.signum(yaw);
            pitch = Math.min(Math.abs(pitch), 120) * Math.signum(pitch);

            rot = rot.rotate(up, yaw * Time.deltaTime());
            rot = rot.rotate(right, pitch * Time.deltaTime());
           
            if (isKeyDown(KEY_A)) {
                rot = rot.rotate(forward, -90 * Time.deltaTime());
            }
           
            if (isKeyDown(KEY_D)) {
                rot = rot.rotate(forward, 90 * Time.deltaTime());
            }
           
            float thrust = 00.0f;
           
            if (isKeyDown(KEY_W)) {
                thrust = 20.0f;
            } else if (isKeyDown(KEY_S)) {
                thrust = -20.0f;
            }

            m.velocity = rot.applyRotation(new Vector3(0, 0, -thrust));

            centerMouse();
        }
View Full Code Here

                Planet planet = (Planet) entity;
                if (Vector3.distance(transform.position, planet.transform.position) < radius + planet.radius) {
                    RigidBody rb1 = rigidBody();
                    RigidBody rb2 = planet.rigidBody();
                   
                    Vector3 momentum = rb1.velocity.times(rb1.mass).plus(rb2.velocity.times(rb2.mass));
                   
                    float mass = rb1.mass + rb2.mass;
                   
                    float vol1 = (4.0f / 3.0f) * Trig.PI * radius * radius * radius;
                    float vol2 = (4.0f / 3.0f) * Trig.PI * planet.radius * planet.radius * planet.radius;
 
View Full Code Here

            Material m = new Material(Color.BLACK);
            m.emissive = Color.ORANGE;
            beam = rect(m, 100, 0.05f);
            beam.transform.forward = Vector3.xAxis();
            beam.transform.up = Vector3.yAxis();
            beam.transform.position = new Vector3(0.15f, 0.075f, -50.5f);
            beam.transform.position = new Vector3(0.15f, 0.075f, -50.5f);

            //turret.addChild(new Entity(beam));
            shooty = new Behavior() {
                @Override
                public void update() {
View Full Code Here

            view.up = m2.transformVector(internalView.up);
            view.setForward(m2.transformVector(internalView.forward));

            view.position = transform.position.plus(view.forward.times(-20.0f));

            Vector3 engineDir1 = new Vector3(0, internalView.forward.y, internalView.forward.z);
            Vector3 engineDir2 = new Vector3(0, -internalView.forward.y, internalView.forward.z);

            Vector3 rfDir = engineDir1;
            Vector3 rrDir = engineDir1;
            Vector3 lfDir = engineDir1;
            Vector3 lrDir = engineDir1;

            if (isKeyDown(KEY_W)) {
                rrDir = Vector3.zAxis().negate();
                lrDir = Vector3.zAxis().negate();
                thrust = 1.0f;
View Full Code Here

        addBehavior(new Billboard(model));

        transform.position = pos;

        model.transform.scale = new Vector3(0.0f);

        addBehavior(new Behavior() {
            @Override
            public void update() {
                model.transform.scale.x += 8.0f * Time.deltaTime();
 
View Full Code Here

    public void capture() {
        glViewport(0, 0, width, height);
       
        FloatBuffer pt = BufferUtils.createFloatBuffer(4);
       
        Vector3 pos = Light.lights[0].pos;
       
        GLU.gluProject(pos.x, pos.y, pos.z, modelViewMatrix().getBuffer(), projectionMatrix().getBuffer(), viewport(), pt);
       
        glBindTexture(GL_TEXTURE_2D, 0);
        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboID);
View Full Code Here

TOP

Related Classes of aspect.util.Vector3

Copyright © 2018 www.massapicom. 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.