Physics Component

Summary
Physics Component
PhysicsObjectBase class for Physics Component and elements that are added to the Physics Component
Functions
NKDisableSimulationDisables any simulation that this Physics Object might be doing.
NKEnableSimulationEnables any simulation that this Physics Object might be doing.
NKSetMass
NKGetMass
NKCalcEffImpulseAt
NKApplyLinearImpulse
NKApplyAngularImpulse
NKApplyImpulseAt
NKGetLinearVelocity
NKGetAngularVelocity
NKGetVelocityAt
NKSetVelocity
NKSetLinearVelocity
NKSetAngularVelocity
NKSetScale
NKSetPosition
NKSetOrientation
NKDrawDebugInfoMakes the Physics Component or Element draw debugging information in the world (Debug Only)
NKSetLayer
NKGetLayer
ColliderElementBase class for derived collider element types
Functions
NKSetTriggerEventsEnabled
NKSetContactEventsEnabled
NKSetMaterialID
NKSetIsTrigger
NKSetCenter
NKSetName
NKGetName
NKGetMaterialID
NKIsTrigger
NKGetCenter
NKSetLODSets the Collider’s collision Level of Detail.
NKGetLOD
BoxColliderA Physics Element that represents a primitive box collision
SphereColliderA Physics Element that represents a primitive sphere collision
ConeColliderA Physics Element that represents a primitive cone collision
CylinderColliderA Physics Element that represents a primitive cylinder collision
CapsuleColliderA Physics Element that represents a primitive cylinder collision
Functions
NKGetHeight
NKGetRadius
NKSetHeight
NKSetRadius
MeshColliderA Physics Element that represents a collision shape built from a mesh resource
Functions
NKSetMesh
RigidbodyElementA Physics Element that allows a gameobject to have rigidbody dynamics.
Functions
NKSetActivationEventsEnabled
NKSetBroadphaseEventsEnabled
NKSetLockedRotationAxis
NKIsXRotationLocked
NKIsYRotationLocked
NKIsZRotationLocked
PhysicsComponentThe primary Physics class that is added to Gameobjects.
Functions
NKEnableSimulation
NKSetMotionType
NKGetMotionType
NKGetRigidbody
NKGetColliderAt
NKGetCollider
NKGetColliders
NKDrawRigidbodyNot yet implemented.
NKDrawControllerNot yet implemented.
NKDrawColliders
NKSetActivationEventsEnabled
NKSetBroadphaseEventsEnabled
NKSetTriggerEventsEnabled
NKSetContactEventsEnabled
NKActivateReverse compatability.
NKDeactivateReverse compatability.

PhysicsObject

Base class for Physics Component and elements that are added to the Physics Component

Summary
Functions
NKDisableSimulationDisables any simulation that this Physics Object might be doing.
NKEnableSimulationEnables any simulation that this Physics Object might be doing.
NKSetMass
NKGetMass
NKCalcEffImpulseAt
NKApplyLinearImpulse
NKApplyAngularImpulse
NKApplyImpulseAt
NKGetLinearVelocity
NKGetAngularVelocity
NKGetVelocityAt
NKSetVelocity
NKSetLinearVelocity
NKSetAngularVelocity
NKSetScale
NKSetPosition
NKSetOrientation
NKDrawDebugInfoMakes the Physics Component or Element draw debugging information in the world (Debug Only)
NKSetLayer
NKGetLayer

Functions

NKDisableSimulation

Comment

Disables any simulation that this Physics Object might be doing.

NKEnableSimulation

Comment

Enables any simulation that this Physics Object might be doing.  Dynamic motion, produce collisions.

NKSetMass

Parameters

Number0 < mass < INF

Comment

Sets the massvaries based on the implementation.  RigidbodyElement: Increases the mass towards the center of mass.  ColliderElement(s): Sets the mass of the collider.

NKGetMass

Returns

NumberThe mass

Comment

If called on PhysicsComponent this reutnrs the aggragte mass.  Elements will return their stored value.

NKCalcEffImpulseAt

Parameters

vec3Velocity vector
vec3position offset from the center of mass

Returns

vec3The effective impulse.

Comment

Calculates the effective impulse generated from the given velocity at a given position offset from the center of mass.  This takes into account the mass distribution of the object.

NKApplyLinearImpulse

Parameters

vec3Impulse vector

Comment

Applies an impulse to the center of mass.  Does not generate any rotational velocity.  The magnitude of the impulse vector determines the strength and the normal represents the direction.

NKApplyAngularImpulse

Parameters

vec3Angular Impulse vector (torque)

Comment

Applies an angular impulse (torque) to the center of mass.  Does not generate any linear velocity.  The magnitude of the angular impulse vector determines the strength and the normal represents the axis that will be rotated about.

NKApplyImpulseAt

Parameters

vec3Impulse vector
vec3Vector offset from the center of mass

Comment

Applies an impulse at a given location offset from the center of mass.  Generates both a linear and angular velocity.

NKGetLinearVelocity

Returns

vec3velocity

Comment

Returns the linear velocity.  The normal represents the direction and the magnitude represents the speed.

NKGetAngularVelocity

Returns

vec3angualr velocity

Comment

Returns the angular rotation velocity.  The normal represents the axis that is being rotated about and the magnitude represents the rate.

NKGetVelocityAt

Parameters

vec3offset location

Returns

vec3Linear velocity

Comment

Returns the Linear Velocity of an object at a given point.  For example, a rotating object will have a low velocity at the center but increasingly higher velocities the further away.

NKSetVelocity

Parameters

vec3Linear Velocity
vec3Angular Velocity

Comment

Sets both the Linear and Angular velocity of the object instantly.

NKSetLinearVelocity

Parameters

vec3Linear Velocity

Comment

Returns the linear velocity of the object.

NKSetAngularVelocity

Parameters

varAngular Velocity

Comment

Returns the angular velocity of the object.

NKSetScale

Parameters

Number0 < scale < INF

Comment

Sets the scale of the physics collision.  (Advanced Use)

NKSetPosition

Parameters

vec3Position

Comment

Sets the position of a given element.  (Advanced Use)

NKSetOrientation

Parameters

vec3Orientation

Comment

Sets the orientation of a given element.  (Advanced Use)

NKDrawDebugInfo

Comment

Makes the Physics Component or Element draw debugging information in the world (Debug Only)

NKSetLayer

Parameters

CollisionLayerIDLayer ID

Comment

Set the current collision layer for this physics object.

NKGetLayer

Returns

CollisionLayerIDLayer ID

Comment

Get the current collision layer that this physics object is set to.

ColliderElement

Functions

NKSetTriggerEventsEnabled

Parameters

BooleanEnabled status

Comment

Sets trigger events to enabled/disabled for this collider.

NKSetContactEventsEnabled

Parameters

BooleanEnabled status

Comment

Sets contact events to enabled/disabled for this collider.

NKSetMaterialID

Parameters

NumberMaterial ID

Comment

Sets the physics material that this collider uses (Experimental)

See Also

PhysicsStandardMaterialsEnum

NKSetIsTrigger

Parameters

BooleanTrigger flag

Comment

Sets the given collider to be a trigger (produces no collision) or to be normal collider (will produce collision)

NKSetCenter

Parameters

vec3offset from center

Comment

Sets the center of a collider

NKSetName

Parameters

StringCollider name

Comment

Set the name of the collider with the given String name.

NKGetName

Returns

StringCollider name

Comment

Returns the name of the collider that was assigned during runtime or within the collider’s data section within a datafile.

NKGetMaterialID

Returns

NumberMaterial ID

Comment

Returns the physics material ID that is assigned to this collider.

NKIsTrigger

Returns

BooleanIs a trigger or not

Comment

Ask a collider if it is a trigger or not

NKGetCenter

Returns

vec3Center relative to Gameobject’s world position.

Comment

Returns the center relative to the Gameobject that this collider is attached to.

NKSetLOD

Comment

Sets the Collider’s collision Level of Detail.

NKGetLOD

Returns

NumberLevel of Detail Enum

Comment

Get the Collider’s current Level of Detail.

BoxCollider

A Physics Element that represents a primitive box collision

Inherits:

SphereCollider

A Physics Element that represents a primitive sphere collision

Inherits:

ConeCollider

A Physics Element that represents a primitive cone collision

Inherits:

CylinderCollider

A Physics Element that represents a primitive cylinder collision

Inherits:

CapsuleCollider

A Physics Element that represents a primitive cylinder collision

Inherits:

Functions

NKGetHeight

Returns

NumberHeight

Comment

Returns the height of the capsule shape.

NKGetRadius

Returns

NumberRadius

Comment

Returns the radius of the capsule shape.

NKSetHeight

Parameters

NumberHeight

Comment

Sets the height of the capsule shape.

NKSetRadius

Parameters

NumberHeight

Comment

Sets the radius of the capsule shape.

MeshCollider

A Physics Element that represents a collision shape built from a mesh resource

Inherits:

Functions

NKSetMesh

Parameters

<StaticGraphicsComponent>Graphics resources

Comment

Set the reference graphics model that the mesh shape should use to produce collision.

Functions

NKSetActivationEventsEnabled

Parameters

BooleanEnabled / Disabled

Comment

Set body activation / deactivation events to be enabled or disabled (raise to lua)fires when the simulation flags a body to sleep due to no motion or when waking when it (might) be moved.  This event is directly tied to the motion.

NKSetBroadphaseEventsEnabled

Parameters

BooleanEnabled / Disabled

Comment

Set body broadphase events to be enabled or disabled (raise to lua)fires when the body is very far from the physics simulation.  This event is directly tied to the motion.

NKSetLockedRotationAxis

Parameters

BooleanLock X Rotation
BooleanLock Y Rotation
BooleanLock Z Rotation

Comment

Sets which axis will have locked rotation.  (Truelocked, False - unlocked)

NKIsXRotationLocked

Returns

BooleanLock status of X axis

Comment

Returns the locked status of the X axis

NKIsYRotationLocked

Returns

BooleanLock status of Y axis

Comment

Returns the locked status of the Y axis

NKIsZRotationLocked

Returns

BooleanLock status of Z axis

Comment

Returns the locked status of the Z axis

PhysicsComponent

The primary Physics class that is added to Gameobjects.  Holds elements to define the physics of the object.

Inherits:

Functions

NKEnableSimulation

Parameters

Boolean = TrueFlag to reset the physics state to have no velocity and force synchronize with the owning GameObject’s Transform.

Comment

This is used to enable the simulation of an object.  If there is a RigidbodyElement this will enable motion (if it is DYNAMIC).  If there is ColliderElements it will enable collision response.

NKSetMotionType

Parameters

PhysicsComponent.MotionTypeMotion Type

Comment

Set the motion type of this physics object to the supplied type.

Example

self:NKGetPhysics():NKSetMotionType(PhysicsComponent.DYNAMIC)

NKGetMotionType

Returns

PhysicsComponent.MotionTypeMotion Type

Comment

Returns the current motion type as an enumeration.

NKGetRigidbody

Returns

<RigidbodyElement>Rigidbody Element (max of 1 per PhysicsComponent)

Comment

Returns the RigidbodyElement if there is one attached to this PhysicsComponent.  Otherwise, returns nil.  IF the PhysicsComponent has Colliders the Motion Type can only be STATIC.  However, adding a RigidbodyElement will only allow DYNAMIC and KEYFRAMED.  Set the body to KEYFRAMED if STATIC behavior is desired.

NKGetColliderAt

Parameters

NumberCollider Index

Returns

<ColliderElement>An attached Collider.

Comment

Returns the Collider at the given index.

NKGetCollider

Parameters

String(Optional) Collider Name

Returns

<ColliderElement>An attached Collider Element (Can be nil)

Comment

( )Returns the first attached Collider (there is no guruntee that this will always yield the same collider)
( name )Attempts to return an attached collider that has a name matching the given String name paramater.

NKGetColliders

Returns

TableAn indexed table of Colliders

Comment

Returns all the colliders that are added to this PhysicsComponent.  (Use NKGetName to identify unique colliders)

NKDrawRigidbody

Comment

Not yet implemented.

NKDrawController

Comment

Not yet implemented.

NKDrawColliders

Comment

Tells the renderer to draw the collision shape once on the next framerequires debugging (internal)

NKSetActivationEventsEnabled

Parameters

BooleanEnable / Disable

Comment

Set body activation / deactivation events to be enabled or disabled (raise to lua)fires when the simulation flags a body to sleep due to no motion or when waking when it (might) be moved.  Calling this on PhysicsComponent cause it to automatically decide which element needs to be enabled for these events to raise properly.

NKSetBroadphaseEventsEnabled

Parameters

BooleanEnable / Disable

Comment

Set body broadphase events to be enabled or disabled (raise to lua)fires when the body is very far from the physics simulation.  Calling this on PhysicsComponent cause it to automatically decide which element needs to be enabled for these events to raise properly.

NKSetTriggerEventsEnabled

Parameters

BooleanEnable / Disable

Comment

Set body trigger events to be enabled or disabled (raise to lua)fires when the body interacts with trigger volumes (Enter / Leave / Update) Calling this on PhysicsComponent cause it to automatically decide which element needs to be enabled for these events to raise properly.

NKSetContactEventsEnabled

Parameters

BooleanEnable / Disable

Comment

Set body contact events to be enabled or disabled (raise to lua)fires when the body comes into contact with any other body within the physics simulation.  Calling this on PhysicsComponent cause it to automatically decide which element needs to be enabled for these events to raise properly.

NKActivate

Comment

Reverse compatability. use NKSetMotionType(PhysicsComponent.DYNAMIC) instead.

NKDeactivate

Comment

Reverse compatability. use NKSetMotionType(PhysicsComponent.STATIC) instead.

Base class for Physics Component and elements that are added to the Physics Component
Eternus.PhysicsWorld.Materials
Base class for derived collider element types
Close