Example usage for com.badlogic.gdx.math Quaternion transform

List of usage examples for com.badlogic.gdx.math Quaternion transform

Introduction

In this page you can find the example usage for com.badlogic.gdx.math Quaternion transform.

Prototype

public Vector3 transform(Vector3 v) 

Source Link

Document

Transforms the given vector using this quaternion

Usage

From source file:com.mygdx.game.debugdrawers.ArmatureDebugDrawer.java

License:Apache License

private void drawArmatureNodes(Node currentNode, Vector3 modelPos, Quaternion modelRot, Vector3 parentNodePos,
        Vector3 currentNodePos) {
    currentNode.globalTransform.getTranslation(currentNodePos);
    modelRot.transform(currentNodePos);
    currentNodePos.add(modelPos);/*  w w w. j a  v  a 2 s.  c  o m*/
    drawVertex(currentNodePos, 0.02f, Color.GREEN);
    shapeRenderer.setColor(Color.YELLOW);
    if (currentNode.hasParent()) {
        shapeRenderer.line(parentNodePos, currentNodePos);
    }
    if (currentNode.hasChildren()) {
        float x = currentNodePos.x;
        float y = currentNodePos.y;
        float z = currentNodePos.z;
        for (Node child : currentNode.getChildren()) {
            drawArmatureNodes(child, modelPos, modelRot, currentNodePos, parentNodePos);
            currentNodePos.set(x, y, z);
        }
    }
}

From source file:com.mygdx.game.utilities.GhostCamera.java

License:Apache License

public void rotateAround(Vector3 point, Quaternion quat) {
    tmp.set(point).sub(targetPosition);//from  w  w  w.  ja  v a2 s.  c  om
    targetPosition.add(tmp);
    quat.transform(targetDirection);
    quat.transform(targetUp);
    quat.transform(tmp);
    targetPosition.add(-tmp.x, -tmp.y, -tmp.z);
}