Component that handles VR player movement using controller inputs. Writes locomotion to the actor's SceneNode, which the camera reads from.
More...
#include <VrMovementComponent.h>
|
| | VrMovement (Entities::Scene *owningScene, std::shared_ptr< Entities::SceneNode > sceneNode, Rendering::Headset *headset, Input::XrInputHandler *inputHandler) |
| | Constructs the VR movement component.
|
| | ~VrMovement () override=default |
| | Destroys the VR movement component.
|
| void | beginPlay () override |
| | Called when the component is added to the scene or the game starts.
|
| void | tick (double deltaTime) override |
| | Called every frame if ticking is enabled.
|
| void | endPlay () override |
| | Called when the component is removed or the game ends.
|
| void | setMoveSpeed (float speed) |
| | Sets the horizontal movement speed in units per second.
|
| float | getMoveSpeed () const |
| | Gets the horizontal movement speed in units per second.
|
| void | setVerticalSpeed (float speed) |
| | Sets the vertical movement speed in units per second.
|
| float | getVerticalSpeed () const |
| | Gets the vertical movement speed in units per second.
|
| void | setDeadZone (float deadZone) |
| | Sets the dead zone for thumbstick input (0.0 to 1.0)
|
| float | getDeadZone () const |
| | Gets the thumbstick dead zone.
|
| | Logic (Entities::Scene *owningScene) |
| | Constructs a logic component owned by a scene.
|
| | Logic (const Entities::SpawnContext &context) |
| | Constructs a logic component from spawn context data.
|
| virtual | ~Logic ()=default |
| | Destroys the logic component.
|
| virtual std::string | getComponentName () const |
| | Gets the component type name for debugging/UI.
|
| virtual bool | drawImGui () |
| | Draws component-specific ImGui inspector controls.
|
| virtual bool | drawImGuiName () |
| | Used to alter the name of the entity in the outliner.
|
| bool | hasBegunPlay () const |
| | Checks whether beginPlay() has been called without a matching endPlay().
|
| bool | canTick () const |
| | Checks if the component is currently set to tick.
|
| void | setCanTick (bool enable) |
| | Enables or disables ticking for this component.
|
| Entities::Entity * | getOwningEntity () const |
| | Gets the entity this component belongs to.
|
|
| static constexpr bool | IsUnique = true |
| | This component type is unique per actor.
|
| static constexpr const char * | ComponentName = "VrMovement" |
| | Component registry name.
|
| static constexpr bool | IsUnique = false |
| | Defines whether multiple instances of this component can exist on the same entity. Defaults to false (multiple allowed). Override in derived classes with static constexpr bool IsUnique =
true; if needed.
|
| static constexpr const char * | ComponentName = "Logic" |
| | Fallback component type name. Derived classes may override getComponentName() for custom labels.
|
Component that handles VR player movement using controller inputs. Writes locomotion to the actor's SceneNode, which the camera reads from.
- Right thumbstick: XZ plane movement (forward/back/strafe) aligned to headset facing
- Right/Left trigger: Move up (Y+)
- Right/Left grip: Move down (Y-)
Definition at line 27 of file VrMovementComponent.h.
◆ VrMovement()
Constructs the VR movement component.
- Parameters
-
| owningScene | The scene this component belongs to |
| sceneNode | Scene node to write position to (typically actor's node) |
| headset | Pointer to the headset for orientation queries |
| inputHandler | Pointer to the XR input handler |
◆ ~VrMovement()
| Engine::Components::VrMovement::~VrMovement |
( |
| ) |
|
|
overridedefault |
Destroys the VR movement component.
◆ beginPlay()
| void Engine::Components::VrMovement::beginPlay |
( |
| ) |
|
|
overridevirtual |
◆ endPlay()
| void Engine::Components::VrMovement::endPlay |
( |
| ) |
|
|
overridevirtual |
◆ getDeadZone()
| float Engine::Components::VrMovement::getDeadZone |
( |
| ) |
const |
|
inlinenodiscard |
◆ getHeadsetForwardXZ()
| glm::vec3 Engine::Components::VrMovement::getHeadsetForwardXZ |
( |
| ) |
const |
|
nodiscardprivate |
◆ getMoveSpeed()
| float Engine::Components::VrMovement::getMoveSpeed |
( |
| ) |
const |
|
inlinenodiscard |
Gets the horizontal movement speed in units per second.
- Returns
- Horizontal movement speed.
Definition at line 63 of file VrMovementComponent.h.
References moveSpeed_.
◆ getVerticalSpeed()
| float Engine::Components::VrMovement::getVerticalSpeed |
( |
| ) |
const |
|
inlinenodiscard |
◆ setDeadZone()
| void Engine::Components::VrMovement::setDeadZone |
( |
float | deadZone | ) |
|
|
inline |
◆ setMoveSpeed()
| void Engine::Components::VrMovement::setMoveSpeed |
( |
float | speed | ) |
|
|
inline |
◆ setVerticalSpeed()
| void Engine::Components::VrMovement::setVerticalSpeed |
( |
float | speed | ) |
|
|
inline |
◆ tick()
| void Engine::Components::VrMovement::tick |
( |
double | deltaTime | ) |
|
|
overridevirtual |
Called every frame if ticking is enabled.
- Parameters
-
| deltaTime | Time elapsed since last frame. |
Reimplemented from Engine::Components::Logic.
◆ ComponentName
| const char* Engine::Components::VrMovement::ComponentName = "VrMovement" |
|
staticconstexpr |
◆ deadZone_
| float Engine::Components::VrMovement::deadZone_ = 0.15f |
|
private |
◆ headset_
◆ inputHandler_
◆ IsUnique
| bool Engine::Components::VrMovement::IsUnique = true |
|
staticconstexpr |
◆ moveSpeed_
| float Engine::Components::VrMovement::moveSpeed_ = 3.0f |
|
private |
◆ sceneNode_
◆ verticalSpeed_
| float Engine::Components::VrMovement::verticalSpeed_ = 2.0f |
|
private |
The documentation for this class was generated from the following file: