Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(JOML): migrate EntityMotionState #4355

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}

}