Search in sources :

Example 31 with Vector3

use of com.badlogic.gdx.math.Vector3 in project nhglib by VoidZombie.

the class NodeComponent method getScaleDelta.

public Vector3 getScaleDelta() {
    Vector3 res = temp.set(scaleDelta);
    scaleDelta.set(Vector3.Zero);
    return res;
}
Also used : Vector3(com.badlogic.gdx.math.Vector3)

Example 32 with Vector3

use of com.badlogic.gdx.math.Vector3 in project nhglib by VoidZombie.

the class NodeComponent method getRotationDelta.

public Vector3 getRotationDelta() {
    Vector3 res = temp.set(rotationDelta);
    rotationDelta.set(Vector3.Zero);
    return res;
}
Also used : Vector3(com.badlogic.gdx.math.Vector3)

Example 33 with Vector3

use of com.badlogic.gdx.math.Vector3 in project nhglib by VoidZombie.

the class PhysicsSystem method process.

@Override
protected void process(int entityId) {
    NodeComponent nodeComponent = nodeMapper.get(entityId);
    RigidBodyComponent bodyComponent = rigidBodyMapper.get(entityId);
    if (!bodyComponent.isAdded()) {
        Matrix4 initialTransform = new Matrix4();
        Vector3 trn = nodeComponent.getTranslation();
        Vector3 scl = new Vector3(1, 1, 1);
        Quaternion rtn = nodeComponent.getRotationQuaternion();
        initialTransform.set(trn, rtn, scl);
        bodyComponent.addToWorld(dynamicsWorld, initialTransform);
    } else {
        nodeComponent.setTranslation(bodyComponent.getTranslation());
        nodeComponent.setRotation(bodyComponent.getRotation());
        nodeComponent.applyTransforms();
    }
}
Also used : RigidBodyComponent(io.github.voidzombie.nhglib.runtime.ecs.components.physics.RigidBodyComponent) Quaternion(com.badlogic.gdx.math.Quaternion) NodeComponent(io.github.voidzombie.nhglib.runtime.ecs.components.scenes.NodeComponent) Vector3(com.badlogic.gdx.math.Vector3) Matrix4(com.badlogic.gdx.math.Matrix4)

Example 34 with Vector3

use of com.badlogic.gdx.math.Vector3 in project Entitas-Java by Rubentxu.

the class InputManagerGDX method touchUp.

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    int indexPointer = (mouse) ? button : pointer;
    //set the state of all touch state events
    if (indexPointer < inputStateData.pointerStates.length) {
        PointerState<Vector2, Vector3> t = inputStateData.pointerStates[indexPointer];
        t.worldCoordinates.set(screenX, screenY, 0);
        camera.unproject(t.worldCoordinates);
        t.down = false;
        t.released = true;
        t.clickTime = 0;
        t.coordinates.x = t.worldCoordinates.x;
        t.coordinates.y = t.worldCoordinates.y;
        if (joints[indexPointer] != null) {
            physics.destroyJoint(joints[indexPointer]);
            joints[indexPointer] = null;
        }
    }
    return false;
}
Also used : Vector2(com.badlogic.gdx.math.Vector2) Vector3(com.badlogic.gdx.math.Vector3) MouseJoint(com.badlogic.gdx.physics.box2d.joints.MouseJoint)

Example 35 with Vector3

use of com.badlogic.gdx.math.Vector3 in project Entitas-Java by Rubentxu.

the class InputManagerGDX method touchDown.

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    int indexPointer = (mouse) ? button : pointer;
    //set the state of all touch state events
    if (indexPointer < inputStateData.pointerStates.length) {
        PointerState<Vector2, Vector3> t = inputStateData.pointerStates[indexPointer];
        t.down = true;
        t.pressed = true;
        //recording last position for displacement values
        t.lastPosition.x = t.coordinates.x;
        t.lastPosition.y = t.coordinates.y;
        t.worldCoordinates.set(screenX, screenY, 0);
        camera.unproject(t.worldCoordinates);
        //store the coordinates of this touch event
        t.coordinates.x = t.worldCoordinates.x;
        t.coordinates.y = t.worldCoordinates.y;
        physics.QueryAABB(queryCallback, t.coordinates.x, t.coordinates.y, t.coordinates.x, t.coordinates.y);
    }
    return false;
}
Also used : Vector2(com.badlogic.gdx.math.Vector2) Vector3(com.badlogic.gdx.math.Vector3) MouseJoint(com.badlogic.gdx.physics.box2d.joints.MouseJoint)

Aggregations

Vector3 (com.badlogic.gdx.math.Vector3)64 Matrix4 (com.badlogic.gdx.math.Matrix4)10 Quaternion (com.badlogic.gdx.math.Quaternion)9 Vector2 (com.badlogic.gdx.math.Vector2)6 Node (com.badlogic.gdx.graphics.g3d.model.Node)5 Texture (com.badlogic.gdx.graphics.Texture)4 Model (com.badlogic.gdx.graphics.g3d.Model)4 NodeKeyframe (com.badlogic.gdx.graphics.g3d.model.NodeKeyframe)4 BoundingBox (com.badlogic.gdx.math.collision.BoundingBox)4 VertexAttribute (com.badlogic.gdx.graphics.VertexAttribute)3 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)3 Material (com.badlogic.gdx.graphics.g3d.Material)3 ModelNode (com.badlogic.gdx.graphics.g3d.model.data.ModelNode)3 ModelBuilder (com.badlogic.gdx.graphics.g3d.utils.ModelBuilder)3 Mesh (com.badlogic.gdx.graphics.Mesh)2 OrthographicCamera (com.badlogic.gdx.graphics.OrthographicCamera)2 ModelInstance (com.badlogic.gdx.graphics.g3d.ModelInstance)2 Animation (com.badlogic.gdx.graphics.g3d.model.Animation)2 MeshPart (com.badlogic.gdx.graphics.g3d.model.MeshPart)2 NodeAnimation (com.badlogic.gdx.graphics.g3d.model.NodeAnimation)2