MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / PilotController

Class PilotController

engine/Poseidon/Input/PilotController.hpp:12–42  ·  view source on GitHub ↗

PilotController — abstract interface that produces VehicleControls from input. Subclasses read from InputSubsystem and apply context-appropriate response curves.

Source from the content-addressed store, hash-verified

10// PilotController — abstract interface that produces VehicleControls from input.
11// Subclasses read from InputSubsystem and apply context-appropriate response curves.
12class PilotController
13{
14 public:
15 virtual ~PilotController() = default;
16
17 // Produce controls for this frame
18 virtual VehicleControls Poll(float deltaT) = 0;
19
20 // Which input context this controller serves
21 virtual InputContext GetContext() const = 0;
22
23 // Response curve configuration
24 void SetSteeringCurve(ResponseCurve curve) { steeringCurve_ = curve; }
25 void SetThrottleCurve(ResponseCurve curve) { throttleCurve_ = curve; }
26 void SetPitchCurve(ResponseCurve curve) { pitchCurve_ = curve; }
27 void SetRollCurve(ResponseCurve curve) { rollCurve_ = curve; }
28 void SetYawCurve(ResponseCurve curve) { yawCurve_ = curve; }
29
30 const ResponseCurve& GetSteeringCurve() const { return steeringCurve_; }
31 const ResponseCurve& GetThrottleCurve() const { return throttleCurve_; }
32 const ResponseCurve& GetPitchCurve() const { return pitchCurve_; }
33 const ResponseCurve& GetRollCurve() const { return rollCurve_; }
34 const ResponseCurve& GetYawCurve() const { return yawCurve_; }
35
36 protected:
37 ResponseCurve steeringCurve_ = ResponseCurve::Stick();
38 ResponseCurve throttleCurve_ = ResponseCurve::Trigger();
39 ResponseCurve pitchCurve_ = ResponseCurve::Stick();
40 ResponseCurve rollCurve_ = ResponseCurve::Stick();
41 ResponseCurve yawCurve_ = ResponseCurve::Stick();
42};
43} // namespace Poseidon
44

Callers

nothing calls this directly

Calls 1

TriggerFunction · 0.85

Tested by

no test coverage detected