public Vector3f getViewDirection() {
CharacterComponent character = getCharacterEntity().getComponent(CharacterComponent.class);
if (character == null) {
return Direction.FORWARD.getVector3f();
}
Quat4f rot = new Quat4f();
QuaternionUtil.setEuler(rot, TeraMath.DEG_TO_RAD * character.yaw, TeraMath.DEG_TO_RAD * character.pitch, 0);
// TODO: Put a generator for direction vectors in a util class somewhere
// And just put quaternion -> vector somewhere too
Vector3f dir = Direction.FORWARD.getVector3f();
return QuaternionUtil.quatRotate(rot, dir, dir);