API reference
API reference
Select your platform
No SDKs available
No versions available

PlayerAvatarPhysicsSystem Class

Extends SystemBase
Modifiers: final
System that creates and updates kinematic physics colliders following the player's avatar.
This system monitors entities with PlayerAvatarPhysics components and creates kinematic physics bodies that follow the player's head and hand positions. These colliders push dynamic objects but cannot themselves be pushed (kinematic behavior).
The body collider is a capsule that extends from near the floor up to the head position. Hand colliders are optional spheres that follow controller positions.
Example usage:
// Create an entity with player avatar physics
Entity.create(
    listOf(
        PlayerAvatarPhysics(
            bodyEnabled = true,
            bodyRadius = 0.25f,
            handsEnabled = true,
            handRadius = 0.1f
        )
    )
)

<ul><li>Colliders are kinematic (mass = 0, CF_KINEMATIC_OBJECT flag)</li><li>They follow tracked poses each frame via setPose()</li><li>Dynamic objects are pushed naturally by physics engine</li><li>Heavy objects will resist being pushed (no infinite impulse)</li></ul>
<ul><li>Uses imperative ScenePhysicsObject API for pose updates (requirement 7)</li><li>Body capsule dimensions are computed from head height each frame</li><li>Hand colliders only created when handsEnabled = true</li><li>Collider shapes are reused where possible (requirement 7)</li></ul>

Signature

class PlayerAvatarPhysicsSystem : SystemBase

Constructors

PlayerAvatarPhysicsSystem ()
Signature
constructor()

Properties

executeCount : Long
[Get]
The number of times the system has been executed.
Signature
var executeCount: Long
systemManager : SystemManager
[Get][Set]
The system manager that this system is associated with.
Signature
lateinit var systemManager: SystemManager

Functions

associateSystemManager ( systemManager )
Associates this system with a system manager, used in the Spatial SDK.
Signature
fun associateSystemManager(systemManager: SystemManager)
Parameters
systemManager: SystemManager
  The system manager to associate with.
delete ( entity )
System should do any housekeeping based on PlayerAvatarPhysicsSystem.delete being removed from the scene
Signature
open override fun delete(entity: Entity)
Parameters
entity: Entity
destroy ()
System should clean up any and all resources for shutdown
Signature
open fun destroy()
equals ( other )
Checks if this system is equal to another object.
Signature
open operator override fun equals(other: Any?): Boolean
Parameters
other: Any?
  The object to compare with.
Returns
Boolean
  True if this system is equal to the other object, false otherwise.
execute ()
System should perform all the operations based on relevant entities.
Signature
open override fun execute()
getDependencies ()
Returns the dependencies of this system.
Signature
open fun getDependencies(): SystemDependencies?
Returns
  The dependencies of this system, or null if there are no dependencies.
getScene ()
Returns the scene that this system is associated with.
Signature
fun getScene(): Scene
Returns
  The scene that this system is associated with.
hashCode ()
Returns the hash code of this system.
Signature
open override fun hashCode(): Int
Returns
Int
  The hash code of this system.
Did you find this page helpful?