| 151 | } |
| 152 | |
| 153 | sim::ComponentPtr loadReactonControlSystem(Entity* entity, const ComponentFactoryContext& context, const nlohmann::json& json) |
| 154 | { |
| 155 | ReactionControlSystemParams params; |
| 156 | params.torque = readVector3(json.at("torque")); |
| 157 | |
| 158 | auto inputsComponent = entity->getFirstComponentRequired<ControlInputsComponent>(); |
| 159 | |
| 160 | ReactionControlSystemComponentConfig config; |
| 161 | config.params = params; |
| 162 | config.node = entity->getFirstComponentRequired<Node>().get(); |
| 163 | config.body = entity->getFirstComponentRequired<DynamicBodyComponent>().get(); |
| 164 | config.stick = inputsComponent->createOrGet("stick", glm::vec2(0), posNegUnitRange<glm::vec2>()); |
| 165 | config.pedal = inputsComponent->createOrGet("pedal", 0.0f, posNegUnitRange<float>()); |
| 166 | |
| 167 | return std::make_shared<ReactionControlSystemComponent>(config); |
| 168 | } |
| 169 | |
| 170 | static sim::ComponentPtr loadRocketMotor(Entity* entity, const ComponentFactoryContext& context, const nlohmann::json& json) |
| 171 | { |
nothing calls this directly
no test coverage detected