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

Physics

Physics

class Physics(linearVelocity: Vector3 = Vector3(0.0f, 0.0f, 0.0f), angularVelocity: Vector3 = Vector3(0.0f, 0.0f, 0.0f), dimensions: Vector3 = Vector3(0.5f, 0.5f, 0.5f), shape: String = "box", densityInternal: Float = 1.0f, applyForce: Vector3 = Vector3(0.0f, 0.0f, 0.0f), restitution: Float = 0.2f, frictionInternal: Vector3 = Vector3(0.5f, 0.0f, 0.0f), state: PhysicsState = PhysicsState.DYNAMIC) : ComponentBase

Constructors

NameSummary
Physics
constructor(linearVelocity: Vector3 = Vector3(0.0f, 0.0f, 0.0f), angularVelocity: Vector3 = Vector3(0.0f, 0.0f, 0.0f), dimensions: Vector3 = Vector3(0.5f, 0.5f, 0.5f), shape: String = "box", densityInternal: Float = 1.0f, applyForce: Vector3 = Vector3(0.0f, 0.0f, 0.0f), restitution: Float = 0.2f, frictionInternal: Vector3 = Vector3(0.5f, 0.0f, 0.0f), state: PhysicsState = PhysicsState.DYNAMIC)

Types

NameSummary
Companion
object Companion : ComponentCompanion

Properties

NameSummary
angularVelocity
var angularVelocity: Vector3
applyForce
var applyForce: Vector3
cachable
open override var cachable: <Error class: unknown class>
density
var density: Float
densityInternal
var densityInternal: Float
dimensions
var dimensions: Vector3
entID
var entID: Long
friction
var friction: FrictionObject
frictionInternal
var frictionInternal: Vector3
isDirty
var isDirty: Boolean
linearVelocity
var linearVelocity: Vector3
recycled
var recycled: Boolean
restitution
var restitution: Float
shape
var shape: String
state
var state: PhysicsState
timeStamp
var timeStamp: Long

Functions

NameSummary
applyMaterial
fun applyMaterial(material: PhysicsMaterial): Physics
companion
open override fun companion(): ComponentCompanion

Gets the companion object for this component.
getComponentDataAttributeType
fun getComponentDataAttributeType(key: Int): AttributePrimitive?

Gets the attribute type for the specified key.



fun getComponentDataAttributeType(keyString: String): AttributePrimitive?

Gets the attribute type for the specified string key.
getComponentDataKey
fun getComponentDataKey(key: String): Int?

Gets the integer key associated with the specified string key.
getComponentDataValue
fun getComponentDataValue(key: Int): Any?

Gets the value for the specified key.



fun getComponentDataValue(keyString: String): Any?

Gets the value for the specified string key.
getEnumClass
fun getEnumClass(key: String): Class<out Enum<*>>?

Gets the enum class associated with the specified string key.
hasComponentData
fun hasComponentData(key: Int): Boolean

Checks if this component has data for the specified key.



fun hasComponentData(keyString: String): Boolean

Checks if this component has data for the specified string key.
read
fun read(e: Entity, cachable: Boolean)

Reads component data from the specified entity.
recycle
fun recycle()

Recycles this component by returning it to its pool.
reset
open fun reset()

Resets the component to its default state.
setComponentDataValue
fun setComponentDataValue(key: Int, value: Any): Boolean

Sets the value for the specified key.



fun setComponentDataValue(keyString: String, value: Any): Boolean

Sets the value for the specified string key.
setPool
fun setPool(pool: ComponentPool<*>, entID: Long)

Sets the component pool and entity ID for this component.
toString
open override fun toString(): String
typeID
open override fun typeID(): Int

Returns the unique type ID of this component.
write
fun write(e: Entity)

Writes this component’s data to the specified entity.

Companion

object Companion : ComponentCompanion

Properties

NameSummary
angularVelocityData
val angularVelocityData: Vector3AttributeData
angularVelocityId
val angularVelocityId: <Error class: unknown class>
applyForceData
val applyForceData: Vector3AttributeData
applyForceId
val applyForceId: <Error class: unknown class>
attributeKeys_
val attributeKeys_: IntArray
attributeTypeCounts_
val attributeTypeCounts_: IntArray
attributeTypes_
val attributeTypes_: IntArray
attrMetaData_
val attrMetaData_: Map<Int, <Error class: unknown class><RegisteredAttributeType, String>>
createDefaultInstance
open override val createDefaultInstance: () -> Physics
densityInternalData
val densityInternalData: FloatAttributeData
densityInternalId
val densityInternalId: <Error class: unknown class>
dimensionsData
val dimensionsData: Vector3AttributeData
dimensionsId
val dimensionsId: <Error class: unknown class>
enumClassesMap_
val enumClassesMap_: Map<Int, Class<out Enum<*>>>
frictionInternalData
val frictionInternalData: Vector3AttributeData
frictionInternalId
val frictionInternalId: <Error class: unknown class>
id
open override val id: <Error class: unknown class>
keyStringToKeyIntMap_
val keyStringToKeyIntMap_: Map<String, Int>
linearVelocityData
val linearVelocityData: Vector3AttributeData
linearVelocityId
val linearVelocityId: <Error class: unknown class>
restitutionData
val restitutionData: FloatAttributeData
restitutionId
val restitutionId: <Error class: unknown class>
shapeData
val shapeData: StringAttributeData
shapeId
val shapeId: <Error class: unknown class>
stateData
val stateData: EnumAttributeData
stateId
val stateId: <Error class: unknown class>

Functions

NameSummary
attributeKeys
open override fun attributeKeys(): IntArray
attributeMetaData
open override fun attributeMetaData(): Map<Int, <Error class: unknown class><RegisteredAttributeType, String>>
attributeTypeCountAvailable
open override fun attributeTypeCountAvailable(): Boolean
attributeTypeCounts
open override fun attributeTypeCounts(): IntArray
attributeTypes
open override fun attributeTypes(): IntArray
dependents
open fun dependents(): IntArray
enumClassesMap
open override fun enumClassesMap(): Map<Int, Class<out Enum<*>>>
keyStringToKeyIntMap
open override fun keyStringToKeyIntMap(keyString: String): Int?
Did you find this page helpful?
Thumbs up icon
Thumbs down icon