This PR adds an ability to stop entity <> body automatic synchronization.
entity.addComponent('body', {
motionType: MOTION_TYPE_KINEMATIC,
objectLayer: OBJ_LAYER_MOVING,
autoUpdateIsometry: false
});
// then on frame update, or when needed, move both - body and entity:
// entity
entity.setPosition(newPosition);
// and body, using one of the movement methods, e.g.:
entity.body.teleport(newPosition);
If set to false, the backend will no longer tell frontend where the dynamic body is, and frontend will not tell backend where a kinematic body is. No effect on static bodies (they don't move anyway).
This is useful when you have many kinematic objects, but rarely change their position/rotation. Then no need to update their isometry every frame.
Fixes: #41
This PR adds an ability to stop
entity <> body
automatic synchronization.If set to
false
, the backend will no longer tell frontend where the dynamic body is, and frontend will not tell backend where a kinematic body is. No effect on static bodies (they don't move anyway).This is useful when you have many kinematic objects, but rarely change their position/rotation. Then no need to update their isometry every frame.