use of io.github.voidzombie.nhglib.data.models.serialization.physics.ActivationState in project nhglib by VoidZombie.
the class RigidBodyComponentJson method parse.
@Override
public void parse(JsonValue jsonValue) {
RigidBodyComponent rigidBodyComponent = entities.createComponent(entity, RigidBodyComponent.class);
JsonValue shapeJson = jsonValue.get("shape");
String activationStateString = jsonValue.getString("activationState", "wantsDeactivation");
ActivationState activationStateJson = ActivationState.fromString(activationStateString);
btCollisionShape collisionShape = getCollisionShape(shapeJson);
int activationState = activationStateJson.state;
float mass = jsonValue.getFloat("mass", 1.0f);
float friction = jsonValue.getFloat("friction", 0.5f);
float restitution = jsonValue.getFloat("restitution", 0f);
rigidBodyComponent.build(collisionShape, activationState, mass, friction, restitution);
output = rigidBodyComponent;
}
Aggregations