MCPcopy Create free account
hub / github.com/Prograda/Skybolt / loadReactonControlSystem

Function loadReactonControlSystem

src/Skybolt/SkyboltEngine/ComponentFactory.cpp:153–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153sim::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
170static sim::ComponentPtr loadRocketMotor(Entity* entity, const ComponentFactoryContext& context, const nlohmann::json& json)
171{

Callers

nothing calls this directly

Calls 3

readVector3Function · 0.85
createOrGetMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected