Kanda Players 0.7.0
Loading...
Searching...
No Matches
Player Movement

The Kanda SDK provides a flexible system for player movement that handles both VR and non-VR (PC) players. The system includes "flying", teleportation, and collision handling.

Collision Layers

Player movement relies on the standard physics layers defined in the Foundation package. The following layers are particularly important:

Layer Purpose Usage
TeleportTarget Surfaces that players can teleport to Required for teleport floor colliders
MovementBlocker Surfaces that block player movement Optional for non-teleportable barriers

Teleport Floors

To create a teleport floor, add the TeleportFloor component to your entity. This automatically configures the entity to use the TeleportTarget physics layer.

Movement Blockers

Objects that should block player movement but not be teleport targets can use either layer:

  • Use TeleportTarget for surfaces that can be both teleported to and collided with
  • Use MovementBlocker for surfaces that should only block movement

This separation allows for:

  • Walls that can't be teleported onto but prevent player clipping
  • Railings that should block movement but not be valid teleport targets
  • Decorative elements that shouldn't interfere with player navigation

Movement Types

PC Movement

PC player movement is controlled through:

  • WASD keys for basic movement
  • Arrow keys for panning
  • Left shift for sprint
  • Space bar for teleport
  • Mouse for head rotation

PC player movement is affected by the PcPlayerSettings component, managed by the PlayerSettingsSystem, which controls settings like sensitivity and speed.

The PcHeadMovementBlockerClientSystem handles collisions by:

  1. Performing a sphere cast to detect upcoming collisions
  2. If a collision is detected with a TeleportTarget or MovementBlocker:
    • The movement direction is reversed
    • The player is "pushed back" to prevent clipping
    • Movement remains blocked until the player moves away from the collision

VR Movement

VR player movement supports:

  • Thumbstick locomotion
  • Teleportation to valid targets
  • Natural room-scale movement

Teleportation in VR is triggered by:

  1. Pointing the controller at a valid teleport target
  2. Holding the thumbstick forward
  3. Releasing the thumbstick to teleport

Common Issues

Players Clipping Through Walls

  • Ensure colliders are properly configured
  • Verify physics layers are correctly assigned
  • Check if PcHeadHitCollider component is present and enabled

Invalid Teleport Targets

  • Confirm TeleportFloor component is added
  • Verify physics layer is set to TeleportTarget
    • Check if collider is active and properly sized

Performance Considerations

  • Use simple collider shapes for movement blockers
  • Minimize overlapping collision layers
  • Cache layer masks when performing frequent checks