// Create player avatar physics with hands enabled
val playerPhysics = Entity.create()
playerPhysics.setComponent(
PlayerAvatarPhysics(
bodyRadius = 0.25f,
bodyEnabled = true,
handsEnabled = true,
handRadius = 0.1f
)
)
class PlayerAvatarPhysics(bodyEnabled: Boolean = true, bodyRadius: Float = 0.25f, bodyHeightOffset: Float = 0.15f, floorOffset: Float = 0.0f, handsEnabled: Boolean = false, handRadius: Float = 0.08f, friction: Float = 0.5f, restitution: Float = 0.0f) : ComponentBase
PlayerAvatarPhysics
(
bodyEnabled
, bodyRadius
, bodyHeightOffset
, floorOffset
, handsEnabled
, handRadius
, friction
, restitution
)
|
Signature
constructor(bodyEnabled: Boolean = true, bodyRadius: Float = 0.25f, bodyHeightOffset: Float = 0.15f, floorOffset: Float = 0.0f, handsEnabled: Boolean = false, handRadius: Float = 0.08f, friction: Float = 0.5f, restitution: Float = 0.0f) Parameters
bodyEnabled:
Boolean
bodyRadius:
Float
bodyHeightOffset:
Float
floorOffset:
Float
handsEnabled:
Boolean
handRadius:
Float
friction:
Float
restitution:
Float
Returns |
bodyEnabled
: Boolean
[Get][Set] |
Whether the body capsule collider is active
Signature
var bodyEnabled: Boolean |
bodyHeightOffset
: Float
[Get][Set] |
Vertical offset from head to top of body capsule
Signature
var bodyHeightOffset: Float |
bodyRadius
: Float
[Get][Set] |
Radius of the body capsule in meters
Signature
var bodyRadius: Float |
cachable
: BuildConfig.COMPONENTCACHE_LEVEL >= 1
[Get][Set] |
Signature
open override var cachable: BuildConfig.COMPONENTCACHE_LEVEL >= 1 |
entID
: Long
[Get][Set] |
Signature
var entID: Long |
floorOffset
: Float
[Get][Set] |
Vertical offset from ground to bottom of body capsule
Signature
var floorOffset: Float |
friction
: Float
[Get][Set] |
Friction coefficient for all avatar colliders
Signature
var friction: Float |
handRadius
: Float
[Get][Set] |
Radius of hand colliders in meters
Signature
var handRadius: Float |
handsEnabled
: Boolean
[Get][Set] |
Whether hand sphere colliders are active
Signature
var handsEnabled: Boolean |
isDirty
: Boolean
[Get][Set] |
Signature
var isDirty: Boolean |
recycled
: Boolean
[Get][Set] |
Signature
var recycled: Boolean |
restitution
: Float
[Get][Set] |
Bounciness coefficient (0.0 = no bounce, 1.0 = perfect bounce)
Signature
var restitution: Float |
timeStamp
: Long
[Get][Set] |
Signature
var timeStamp: Long |
companion
()
|
Gets the companion object for this component.
The companion object provides metadata about the component.
Signature
open override fun companion(): ComponentCompanion Throws
RuntimeException
|
getComponentDataAttributeType
(
key
)
|
Gets the attribute type for the specified key.
Signature
fun getComponentDataAttributeType(key: Int): AttributePrimitive? Parameters
key:
Int
|
getComponentDataAttributeType
(
keyString
)
|
Gets the attribute type for the specified string key.
Signature
fun getComponentDataAttributeType(keyString: String): AttributePrimitive? Parameters
keyString:
String
Throws
IllegalArgumentException
|
getComponentDataKey
(
key
)
|
Gets the integer key associated with the specified string key.
Signature
fun getComponentDataKey(key: String): Int? Parameters
key:
String
Returns
Int?
|
getComponentDataValue
(
key
)
|
Gets the value for the specified key.
Signature
fun getComponentDataValue(key: Int): Any? Parameters
key:
Int
Returns
Any?
|
getComponentDataValue
(
keyString
)
|
Gets the value for the specified string key.
Signature
fun getComponentDataValue(keyString: String): Any? Parameters
keyString:
String
Returns
Any?
Throws
IllegalArgumentException
|
getEnumClass
(
key
)
|
Gets the enum class associated with the specified string key.
Signature
fun getEnumClass(key: String): Class<out Enum<*>>? Parameters
key:
String
Returns
Class?
|
hasComponentData
(
key
)
|
Checks if this component has data for the specified key.
Signature
fun hasComponentData(key: Int): Boolean Parameters
key:
Int
Returns
Boolean
|
hasComponentData
(
keyString
)
|
Checks if this component has data for the specified string key.
Signature
fun hasComponentData(keyString: String): Boolean Parameters
keyString:
String
Returns
Boolean
|
read
(
e
, cachable
)
|
Reads component data from the specified entity.
Signature
fun read(e: Entity, cachable: Boolean) Parameters
cachable:
Boolean
|
recycle
()
|
Recycles this component by returning it to its pool.
If the component has a pool assigned, it will be returned to that pool for reuse.
Signature
fun recycle() |
reset
()
|
Resets the component to its default state.
This method is called when a component is recycled to clear any state. Subclasses should override this method to reset their specific state.
Signature
open fun reset() |
setComponentDataValue
(
key
, value
)
|
Sets the value for the specified key.
Signature
fun setComponentDataValue(key: Int, value: Any): Boolean Parameters
key:
Int
value:
Any
Returns
Boolean
|
setComponentDataValue
(
keyString
, value
)
|
Sets the value for the specified string key.
Signature
fun setComponentDataValue(keyString: String, value: Any): Boolean Parameters
keyString:
String
value:
Any
Returns
Boolean
|
setPool
(
pool
, entID
)
|
Sets the component pool and entity ID for this component.
This is used for component recycling to track which pool the component belongs to and which entity it was associated with.
Signature
fun setPool(pool: ComponentPool<*>, entID: Long) Parameters
pool:
ComponentPool
entID:
Long
|
toString
()
|
Signature
open override fun toString(): String Returns
String
|
typeID
()
|
Returns the unique type ID of this component.
Each component type must have a unique ID for identification in the entity-component system.
Signature
open override fun typeID(): Int Returns
Int
|
write
(
e
)
|
Writes this component's data to the specified entity.
Signature
fun write(e: Entity) Parameters |
attributeKeys_
: IntArray
[Get] |
Signature
val attributeKeys_: IntArray |
attributeTypeCounts_
: IntArray
[Get] |
Signature
val attributeTypeCounts_: IntArray |
attributeTypes_
: IntArray
[Get] |
Signature
val attributeTypes_: IntArray |
attrMetaData_
: Map
[Get] |
Signature
val attrMetaData_: Map |
bodyEnabledData
: BooleanAttributeData
[Get] |
Signature
val bodyEnabledData: BooleanAttributeData |
bodyEnabledId
[Get] |
Signature
val bodyEnabledId: |
bodyHeightOffsetData
: FloatAttributeData
[Get] |
Signature
val bodyHeightOffsetData: FloatAttributeData |
bodyHeightOffsetId
[Get] |
Signature
val bodyHeightOffsetId: |
bodyRadiusData
: FloatAttributeData
[Get] |
Signature
val bodyRadiusData: FloatAttributeData |
bodyRadiusId
[Get] |
Signature
val bodyRadiusId: |
createDefaultInstance
: Function0
[Get] |
Signature
open override val createDefaultInstance: () -> PlayerAvatarPhysics |
enumClassesMap_
: Map
[Get] |
Signature
val enumClassesMap_: Map<Int, Class<out Enum<*>>> |
floorOffsetData
: FloatAttributeData
[Get] |
Signature
val floorOffsetData: FloatAttributeData |
floorOffsetId
[Get] |
Signature
val floorOffsetId: |
frictionData
: FloatAttributeData
[Get] |
Signature
val frictionData: FloatAttributeData |
frictionId
[Get] |
Signature
val frictionId: |
handRadiusData
: FloatAttributeData
[Get] |
Signature
val handRadiusData: FloatAttributeData |
handRadiusId
[Get] |
Signature
val handRadiusId: |
handsEnabledData
: BooleanAttributeData
[Get] |
Signature
val handsEnabledData: BooleanAttributeData |
handsEnabledId
[Get] |
Signature
val handsEnabledId: |
id
[Get] |
Signature
open override val id: |
keyStringToKeyIntMap_
: Map
[Get] |
Signature
val keyStringToKeyIntMap_: Map<String, Int> |
restitutionData
: FloatAttributeData
[Get] |
Signature
val restitutionData: FloatAttributeData |
restitutionId
[Get] |
Signature
val restitutionId: |
attributeKeys
()
|
Signature
open override fun attributeKeys(): IntArray Returns
IntArray
|
attributeMetaData
()
| Returns
Map
|
attributeTypeCountAvailable
()
|
Signature
open override fun attributeTypeCountAvailable(): Boolean Returns
Boolean
|
attributeTypeCounts
()
|
Signature
open override fun attributeTypeCounts(): IntArray Returns
IntArray
|
attributeTypes
()
|
Signature
open override fun attributeTypes(): IntArray Returns
IntArray
|
dependents
()
|
Signature
open fun dependents(): IntArray Returns
IntArray
|
enumClassesMap
()
|
Signature
open override fun enumClassesMap(): Map<Int, Class<out Enum<*>>> Returns
Map
|
keyStringToKeyIntMap
(
keyString
)
|
Signature
open override fun keyStringToKeyIntMap(keyString: String): Int? Parameters
keyString:
String
Returns
Int?
|