Skip to content

Commit

Permalink
feat(JOML): migrate EntityMotionState (#4355)
Browse files Browse the repository at this point in the history
  • Loading branch information
pollend authored Dec 31, 2020
1 parent 541a1e7 commit 4157b46
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.slf4j.LoggerFactory;
import org.terasology.entitySystem.entity.EntityRef;
import org.terasology.logic.location.LocationComponent;
import org.terasology.math.JomlUtil;

/**
* This motion state is used to connect rigid body entities to their rigid body in the bullet physics engine.
Expand Down Expand Up @@ -52,8 +51,8 @@ public class EntityMotionState extends btMotionState {
@Override
public void getWorldTransform(Matrix4f transform) {
LocationComponent loc = entity.getComponent(LocationComponent.class);
transform.translationRotateScale(JomlUtil.from(loc.getWorldPosition()),
JomlUtil.from(loc.getWorldRotation()), loc.getWorldScale());
transform.translationRotateScale(loc.getWorldPosition(position),
loc.getWorldRotation(rot), loc.getWorldScale());
}

@Override
Expand All @@ -63,9 +62,9 @@ public void setWorldTransform(Matrix4f transform) {
rot.setFromNormalized(transform);
rot.normalize();
transform.getTranslation(position);
loc.setWorldRotation(JomlUtil.from(rot));
loc.setWorldPosition(JomlUtil.from(position));

loc.setWorldRotation(rot);
loc.setWorldPosition(position);
}
}

}

0 comments on commit 4157b46

Please sign in to comment.