Package aspect.physics

Examples of aspect.physics.RigidBody


        Material earthImage = new Material(loadTexture(new File("textures/earth.png")));
        float earthWidth = 6378.1e3f * 2;
        ViewModel earthSprite = ellipse(earthImage, earthWidth, earthWidth, 100);
        earth = new Entity(earthSprite);
        earth.pos = new Vector3(getCanvasWidth() / 4, getCanvasHeight() / 4, 0);
        earth.addBehavior(new RigidBody());
        earth.rigidBody().mass = 5.97219e24f;

        Material moonImage = new Material(loadTexture(new File("textures/moon.png")));
        float moonWidth = 1737.4e3f * 2;
        ViewModel moonSprite = ellipse(moonImage, moonWidth, moonWidth, 100);
        moon = new Entity(moonSprite);
        moon.pos = new Vector3(earth.pos.x - 384400e3f, earth.pos.y);
        moon.addBehavior(new RigidBody());
        moon.rigidBody().mass = 7.34767309e22f;

        yesThrust = new Material(loadTexture("nothrust", new File("textures/ship.png")));
        yesThrust.setTextureFilter(Material.Filter.MIPMAP, Material.Filter.NEAREST);
        noThrust = new Material(loadTexture("thrust", new File("textures/ship_thrust.png")));
        noThrust.setTextureFilter(Material.Filter.MIPMAP, Material.Filter.NEAREST);
        ViewModel model = rect2D(noThrust, 37.5f, 50f);
        ship = new Entity(model);
        ship.pos = new Vector3(earth.pos.x, earth.pos.y + earthWidth / 2 + 300e3f);
        ship.addBehavior(new RigidBody());
        ship.rigidBody().mass = 78e3f;
        ship.rigidBody().velocity.x = 7700f;

        earthGravity = new PointGravity(earth);
        moonGravity = new PointGravity(moon);
View Full Code Here

TOP

Related Classes of aspect.physics.RigidBody

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.