Package aspect.physics

Examples of aspect.physics.Motion


    public float mouseSensitivity = 5.0f;

    public PlayerShip() {
        Mouse.setGrabbed(true);
        Motion m = new Motion();
        rot = Matrix4x4.identity();
        addBehavior(m);
        addBehavior(new ShipControl());
       
        centerMouse();
View Full Code Here


        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)) {
View Full Code Here

        this.maxSpeed = entity.getBehavior(Motion.class).velocity.mag();
    }

    @Override
    public void update() {
        Motion m = ent.getBehavior(Motion.class);

        m.acceleration = entity.transform.position.minus(ent.transform.position).normalize().times(10.0f);

        if (m.velocity.mag() > maxSpeed) {
            m.velocity = m.velocity.normalize().times(maxSpeed);
View Full Code Here

       
        Material mtl = new Material(shader);
        model = ellipse(mtl, 2.0f, 2.0f, 20);

        addBehavior(new Billboard(model));
        addBehavior(new Motion(vel, Vector3.zero()));
        addBehavior(new TimeToLive(2.0f));

        addBehavior(new Behavior() {
            @Override
            public void update() {
View Full Code Here

    private Behavior flight;

    public Fighter(Fighter leader) {
        super(loadObjModel("fighter", new File("models/fighter.obj"), new Vector3(0.25f)));

        final Motion m = new Motion();
        m.velocity = new Vector3(0, 0, -5);
        addBehavior(m);

        if (leader == null) {
            flight = new Behavior() {
View Full Code Here

    }

    public void die() {
        removeBehavior(flight);
       
        Motion motion = getBehavior(Motion.class);
        System.out.println(motion);
        removeBehavior(motion);
        RigidBody rigidBody = new RigidBody();
        addBehavior(rigidBody);
        rigidBody.velocity = motion.velocity;
View Full Code Here

            return;
        }
       
        FloatBuffer pos = ent.transform.position.getBuffer();
        FloatBuffer vel = BufferUtils.createFloatBuffer(3);
        Motion motion = ent.getBehavior(Motion.class);
       
        if (motion != null) {
            motion.velocity.store(vel);
            vel.flip();
        }
View Full Code Here

        }

        FloatBuffer pos = ent.transform.position.getBuffer();
        FloatBuffer vel = BufferUtils.createFloatBuffer(3);
        FloatBuffer ori = BufferUtils.createFloatBuffer(6);
        Motion motion = ent.getBehavior(Motion.class);

        if (motion != null) {
            motion.velocity.store(vel);
        } else {
            Vector3.zero().store(vel);
View Full Code Here

TOP

Related Classes of aspect.physics.Motion

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.