Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
EngineCore::VrMovementComponent Class Reference

Component that handles VR player movement using controller inputs. More...

#include <VrMovementComponent.h>

Inheritance diagram for EngineCore::VrMovementComponent:
Collaboration diagram for EngineCore::VrMovementComponent:

Public Member Functions

 VrMovementComponent (Scene *owningScene, Headset *headset, Input::XrInputHandler *inputHandler)
 Constructs the VR movement component.
 ~VrMovementComponent () override=default
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
void setVerticalSpeed (float speed)
 Sets the vertical movement speed in units per second.
float getVerticalSpeed () const
void setDeadzone (float deadzone)
 Sets the deadzone for thumbstick input (0.0 to 1.0)
float getDeadzone () const
Public Member Functions inherited from EngineCore::LogicComponent
 LogicComponent (Scene *owningScene)
virtual ~LogicComponent ()=default
bool canTick () const
 Checks if the component is currently set to tick.
void setCanTick (bool enable)
 Enables or disables ticking for this component.
EntitygetOwningEntity () const
 Gets the entity this component belongs to.

Static Public Attributes

static constexpr bool IsUnique = true
Static Public Attributes inherited from EngineCore::LogicComponent
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.

Private Member Functions

glm::vec3 getHeadsetForwardXZ () const

Private Attributes

Headsetheadset_ = nullptr
Input::XrInputHandlerinputHandler_ = nullptr
float moveSpeed_ = 3.0f
float verticalSpeed_ = 2.0f
float deadzone_ = 0.15f

Additional Inherited Members

Protected Member Functions inherited from EngineCore::LogicComponent
ScenegetScene () const
 Gets the scene this component belongs to.
SceneManagergetSceneManager () const
 Helper to get the SceneManager from the owning scene.

Detailed Description

Component that handles VR player movement using controller inputs.

  • Right thumbstick: XZ plane movement (forward/back/strafe) aligned to headset facing
  • Right/Left trigger: Move up (Y+)
  • Right/Left grip: Move down (Y-)
Date
2026-01-20
Author
Konstantin Passig

Definition at line 21 of file VrMovementComponent.h.

Constructor & Destructor Documentation

◆ VrMovementComponent()

EngineCore::VrMovementComponent::VrMovementComponent ( Scene * owningScene,
Headset * headset,
Input::XrInputHandler * inputHandler )

Constructs the VR movement component.

Parameters
owningSceneThe scene this component belongs to
headsetPointer to the headset for updating player position
inputHandlerPointer to the XR input handler

Definition at line 9 of file VrMovementComponent.cpp.

References headset_, inputHandler_, EngineCore::LogicComponent::LogicComponent(), and EngineCore::LogicComponent::setCanTick().

Here is the call graph for this function:

◆ ~VrMovementComponent()

EngineCore::VrMovementComponent::~VrMovementComponent ( )
overridedefault

Member Function Documentation

◆ beginPlay()

void EngineCore::VrMovementComponent::beginPlay ( )
overridevirtual

Called when the component is added to the scene or the game starts.

Reimplemented from EngineCore::LogicComponent.

Definition at line 17 of file VrMovementComponent.cpp.

References EngineCore::LogicComponent::beginPlay().

Here is the call graph for this function:

◆ endPlay()

void EngineCore::VrMovementComponent::endPlay ( )
overridevirtual

Called when the component is removed or the game ends.

Reimplemented from EngineCore::LogicComponent.

Definition at line 64 of file VrMovementComponent.cpp.

References EngineCore::LogicComponent::endPlay().

Here is the call graph for this function:

◆ getDeadzone()

float EngineCore::VrMovementComponent::getDeadzone ( ) const
inlinenodiscard

Definition at line 55 of file VrMovementComponent.h.

References deadzone_.

◆ getHeadsetForwardXZ()

glm::vec3 EngineCore::VrMovementComponent::getHeadsetForwardXZ ( ) const
private

Definition at line 69 of file VrMovementComponent.cpp.

References headset_.

Referenced by tick().

Here is the caller graph for this function:

◆ getMoveSpeed()

float EngineCore::VrMovementComponent::getMoveSpeed ( ) const
inlinenodiscard

Definition at line 43 of file VrMovementComponent.h.

References moveSpeed_.

◆ getVerticalSpeed()

float EngineCore::VrMovementComponent::getVerticalSpeed ( ) const
inlinenodiscard

Definition at line 49 of file VrMovementComponent.h.

References verticalSpeed_.

◆ setDeadzone()

void EngineCore::VrMovementComponent::setDeadzone ( float deadzone)
inline

Sets the deadzone for thumbstick input (0.0 to 1.0)

Definition at line 54 of file VrMovementComponent.h.

References deadzone_.

◆ setMoveSpeed()

void EngineCore::VrMovementComponent::setMoveSpeed ( float speed)
inline

Sets the horizontal movement speed in units per second.

Definition at line 42 of file VrMovementComponent.h.

References moveSpeed_.

◆ setVerticalSpeed()

void EngineCore::VrMovementComponent::setVerticalSpeed ( float speed)
inline

Sets the vertical movement speed in units per second.

Definition at line 48 of file VrMovementComponent.h.

References verticalSpeed_.

◆ tick()

void EngineCore::VrMovementComponent::tick ( double deltaTime)
overridevirtual

Called every frame if ticking is enabled.

Parameters
deltaTimeTime elapsed since last frame.

Reimplemented from EngineCore::LogicComponent.

Definition at line 23 of file VrMovementComponent.cpp.

References deadzone_, getHeadsetForwardXZ(), headset_, inputHandler_, Input::LEFT, moveSpeed_, Input::RIGHT, and verticalSpeed_.

Here is the call graph for this function:

Member Data Documentation

◆ deadzone_

float EngineCore::VrMovementComponent::deadzone_ = 0.15f
private

Definition at line 65 of file VrMovementComponent.h.

Referenced by getDeadzone(), setDeadzone(), and tick().

◆ headset_

Headset* EngineCore::VrMovementComponent::headset_ = nullptr
private

Definition at line 60 of file VrMovementComponent.h.

Referenced by getHeadsetForwardXZ(), tick(), and VrMovementComponent().

◆ inputHandler_

Input::XrInputHandler* EngineCore::VrMovementComponent::inputHandler_ = nullptr
private

Definition at line 61 of file VrMovementComponent.h.

Referenced by tick(), and VrMovementComponent().

◆ IsUnique

bool EngineCore::VrMovementComponent::IsUnique = true
staticconstexpr

Definition at line 23 of file VrMovementComponent.h.

◆ moveSpeed_

float EngineCore::VrMovementComponent::moveSpeed_ = 3.0f
private

Definition at line 63 of file VrMovementComponent.h.

Referenced by getMoveSpeed(), setMoveSpeed(), and tick().

◆ verticalSpeed_

float EngineCore::VrMovementComponent::verticalSpeed_ = 2.0f
private

Definition at line 64 of file VrMovementComponent.h.

Referenced by getVerticalSpeed(), setVerticalSpeed(), and tick().


The documentation for this class was generated from the following files: