Example usage for com.badlogic.gdx.math Matrix4 Matrix4

List of usage examples for com.badlogic.gdx.math Matrix4 Matrix4

Introduction

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

Prototype

public Matrix4(Vector3 position, Quaternion rotation, Vector3 scale) 

Source Link

Document

Construct a matrix from the given translation, rotation and scale.

Usage

From source file:net.smert.frameworkgl.examples.common.BulletGameObjectFactory.java

License:Apache License

public BulletGameObject create(String name, Transform4f worldTransform) {
    Integer existingIndex = nameToIndex.get(name);
    if (existingIndex == null) {
        return null;
    }//w w  w. j a  va2s .c  o  m
    BulletGameObject.Constructor constructor = constructors.get(existingIndex);
    Quaternion4f rotation = new Quaternion4f(worldTransform.getRotation());
    Vector3f position = worldTransform.getPosition();
    Quaternion newRotation = new Quaternion(rotation.getX(), rotation.getY(), rotation.getZ(), rotation.getW());
    Vector3 newPosition = new Vector3(position.getX(), position.getY(), position.getZ());
    Vector3 newScale = new Vector3(1f, 1f, 1f);
    return constructor.create(new Matrix4(newPosition, newRotation, newScale));
}