Base physics class available on client and server. More...
Public Member Functions | |
delegate bool | DepenetrateCallback (ksICollider collider, ref ksVector3 direction, ref float distance) |
Depenetration callback for Depenetrate(ksOverlapParams, out ksVector3, DepenetrateCallback, float) More... | |
virtual void | SyncAll () |
Apply all transform and rigidbody changes to the physics simulation now rather than waiting for the next simulation step. More... | |
virtual void | SyncTransforms () |
Apply entity transform updates to the physics simulation now rather than waiting for the next simulation step. More... | |
abstract bool | RaycastAny (ksRaycastParams args) |
Raycast query that checks if anything was hit. More... | |
abstract bool | RaycastNearest (ksRaycastParams args, out ksRaycastResult hit) |
Raycast query that finds the nearest hit. More... | |
abstract ksQueryHitResults< ksRaycastResult > | Raycast (ksRaycastParams args) |
Raycast query that returns the nearest blocking hit and any touching hits before the blocking hit. More... | |
abstract bool | SweepAny (ksSweepParams args) |
Sweep query that checks if anything was hit. More... | |
abstract bool | SweepNearest (ksSweepParams args, out ksSweepResult hit) |
Sweep query that finds the nearest hit. More... | |
abstract ksQueryHitResults< ksSweepResult > | Sweep (ksSweepParams arg) |
Sweep query that returns the nearest blocking hit and any touching hits before the blocking hit. More... | |
abstract bool | OverlapAny (ksOverlapParams args) |
Overlap query that checks for any overlap. More... | |
abstract List< ksOverlapResult > | Overlap (ksOverlapParams args) |
Overlap query. More... | |
List< ksRaycastResult > | Raycast (ksVector3 origin, ksVector3 direction, float distance, bool includeOverlaps=false, ksQueryFlags flags=ksQueryFlags.DEFAULT, uint groupMask=0xffffffff, uint maxResults=255) |
Raycast. More... | |
List< ksSweepResult > | Sweep (ksShape shape, ksVector3 origin, ksQuaternion rotation, ksVector3 direction, float distance, bool includeOverlaps=false, ksQueryFlags flags=ksQueryFlags.DEFAULT, uint groupMask=0xffffffff, uint maxResults=255) |
Shape sweep. More... | |
List< ksSweepResult > | Sweep (ksIEntity entity, ksVector3 direction, float distance, bool includeOverlaps=false, ksQueryFlags flags=ksQueryFlags.DEFAULT, uint groupMask=0xffffffff, uint maxResults=255) |
Entity sweep using the current position and rotation as starting points. More... | |
List< ksSweepResult > | Sweep (ksIEntity entity, ksVector3 origin, ksQuaternion rotation, ksVector3 direction, float distance, bool excludeSelf=true, bool includeOverlaps=false, ksQueryFlags flags=ksQueryFlags.DEFAULT, uint groupMask=0xffffffff, uint maxResults=255) |
Entity sweep. More... | |
List< ksOverlapResult > | Overlap (ksShape shape, ksVector3 origin, ksQuaternion rotation, ksQueryFlags flags=ksQueryFlags.DEFAULT, uint groupMask=0xffffffff, uint maxResults=255) |
Shape overlap. More... | |
List< ksOverlapResult > | Overlap (ksIEntity entity, ksVector3 origin, ksQuaternion rotation, bool excludeSelf=true, ksQueryFlags flags=ksQueryFlags.DEFAULT, uint groupMask=0xffffffff, uint maxResults=255) |
Entity overlap. More... | |
abstract bool | ComputePenetration (ksICollider collider0, ksVector3 position0, ksQuaternion rotation0, ksICollider collider1, ksVector3 position1, ksQuaternion rotation1, out ksVector3 direction, out float distance) |
Compute the minimal translation required to separate the given colliders apart at specified poses. More... | |
abstract ksVector3 | GetClosestPoint (ksVector3 point, ksICollider collider) |
Get the closest point on a collider to another point. More... | |
abstract ksVector3 | GetClosestPoint (ksVector3 point, ksICollider collider, ksVector3 position, ksQuaternion rotation) |
Get the closest point on a collider to another point. More... | |
ksSweepSlideParams | CreateSimulationQueryParams (ksIEntity entity, bool excludeTouches=true) |
Creates ksSweepSlideParams for an entity configured to use simulation rules. More... | |
bool | Depenetrate (ksOverlapParams args, out ksVector3 delta, DepenetrateCallback callback=null, float separationOffset=.0001f) |
Does an overlap query and calcuates a depenetration delta to attempt to depenetrate from overlapping geometry. More... | |
bool | SweepAndSlide (ksSweepSlideParams args, out ksVector3 position) |
Does sweep-and-slide movement. More... | |
Protected Attributes | |
ksVector3 | m_gravity |
Properties | |
bool | AutoSync [get, set] |
If true, transform changes are synced with the physics system and stale inertia tensors and centers of mass are recalculated automatically before any physics queries. More... | |
ksVector3 | Gravity [get] |
Gets the current gravity in the scene. More... | |
Base physics class available on client and server.
|
pure virtual |
Compute the minimal translation required to separate the given colliders apart at specified poses.
collider0 | First collider to test. |
position0 | Position of collider 0. |
rotation0 | Rotation of collider 0. |
collider1 | Secoond collider to test. |
position1 | Position of collider 1. |
rotation1 | Rotation of collider 1. |
direction | Direction along which the translation required to separate collider0 from collider1 is minimal. |
distance | The distance along the direction that is required to separate collider0 from collider1 . |
Implemented in KS.Reactor.Client.Unity.ksPhysicsAdaptor.
ksSweepSlideParams KS.Reactor.ksBasePhysics.CreateSimulationQueryParams | ( | ksIEntity | entity, |
bool | excludeTouches = true |
||
) |
Creates ksSweepSlideParams for an entity configured to use simulation rules.
Anything the entity would collide with are blocking hits and optionally anything it would receive overlap events with are touching hits. This sets the ksBaseQueryParams.Filter and ksOverlapParams.EntityColliderFilter to a ksSimulationFilter, and sets the ksBaseQueryParams.ExcludeEntity to the entity .
entity | Query entity |
excludeTouches | If true, sets the ksQueryFlags.EXCLUDE_TOUCHES flag. |
bool KS.Reactor.ksBasePhysics.Depenetrate | ( | ksOverlapParams | args, |
out ksVector3 | delta, | ||
DepenetrateCallback | callback = null , |
||
float | separationOffset = .0001f |
||
) |
Does an overlap query and calcuates a depenetration delta to attempt to depenetrate from overlapping geometry.
If the overlap query returns multiple results the depenetration vector from the previous overlap will be added to the position when computing the depenetration vector for the next overlap. This may result in pushing the object back into the first overlapping geometry. Geometry that the object gets pushed into by the depenetration vector that was not initially overlapping will not be considered.
args | Overlap query parameters. The query object cannot be a shape. |
delta | Depenetration delta |
callback | Callback to call for each overlapping collider. Can be used to alter the depenetration vector for each collider, or to cancel the entire depenetration by returning false. |
separationOffset | Amount to add to the depenetration distance for each overlapping collider. Helps prevent penetrations when sweeping. |
delegate bool KS.Reactor.ksBasePhysics.DepenetrateCallback | ( | ksICollider | collider, |
ref ksVector3 | direction, | ||
ref float | distance | ||
) |
Depenetration callback for Depenetrate(ksOverlapParams, out ksVector3, DepenetrateCallback, float)
collider | Collider being penetrated. |
direction | Minimum depenetration movement direction. Can be changed to alter movement direction. |
distance | Minimum depenetration movement distance. Can be changed to alter the movement distance. Set to zero to ignore the penetration. |
|
pure virtual |
Get the closest point on a collider to another point.
Currently supported colliders: box, sphere, capsule, convexmesh.
point | Point to measure from. |
collider | Collider to get the closest point from. |
Implemented in KS.Reactor.Client.Unity.ksPhysicsAdaptor.
|
pure virtual |
Get the closest point on a collider to another point.
Currently supported colliders: box, sphere, capsule, convexmesh.
point | Point to measure from. |
collider | Collider to get the closest point from. |
position | Collider position |
rotation | Collider rotation |
Implemented in KS.Reactor.Client.Unity.ksPhysicsAdaptor.
List<ksOverlapResult> KS.Reactor.ksBasePhysics.Overlap | ( | ksIEntity | entity, |
ksVector3 | origin, | ||
ksQuaternion | rotation, | ||
bool | excludeSelf = true , |
||
ksQueryFlags | flags = ksQueryFlags.DEFAULT , |
||
uint | groupMask = 0xffffffff , |
||
uint | maxResults = 255 |
||
) |
Entity overlap.
entity | Entity. |
origin | Entity point. |
rotation | Entity orientation. |
excludeSelf | Exclude this entity in the returned results. |
flags | Bit flags for filtering static, dynamic, and first hit. |
groupMask | Bit mask of collsion groups. |
maxResults | Unused |
|
pure virtual |
Overlap query.
args | Overlap parameters |
Implemented in KS.Reactor.Client.Unity.ksPhysicsAdaptor.
List<ksOverlapResult> KS.Reactor.ksBasePhysics.Overlap | ( | ksShape | shape, |
ksVector3 | origin, | ||
ksQuaternion | rotation, | ||
ksQueryFlags | flags = ksQueryFlags.DEFAULT , |
||
uint | groupMask = 0xffffffff , |
||
uint | maxResults = 255 |
||
) |
Shape overlap.
shape | Primitive or convex shape. |
origin | Origin point. |
rotation | Shape orientation. |
flags | Bit flags for filtering static, dynamic, and first hit. |
groupMask | Bit mask of collsion groups. |
maxResults | Unused |
|
pure virtual |
Overlap query that checks for any overlap.
args | Overlap parameters |
Implemented in KS.Reactor.Client.Unity.ksPhysicsAdaptor.
|
pure virtual |
Raycast query that returns the nearest blocking hit and any touching hits before the blocking hit.
args | Raycast parameters |
Implemented in KS.Reactor.Client.Unity.ksPhysicsAdaptor.
List<ksRaycastResult> KS.Reactor.ksBasePhysics.Raycast | ( | ksVector3 | origin, |
ksVector3 | direction, | ||
float | distance, | ||
bool | includeOverlaps = false , |
||
ksQueryFlags | flags = ksQueryFlags.DEFAULT , |
||
uint | groupMask = 0xffffffff , |
||
uint | maxResults = 255 |
||
) |
Raycast.
origin | Origin point. |
direction | Direction vector. |
distance | Ray distance. |
groupMask | Bit mask of collsion groups. |
includeOverlaps | Include entities that overlap the origin. |
flags | Bit flags for filtering static, dynamic, and first hit. |
maxResults | Unused |
|
pure virtual |
Raycast query that checks if anything was hit.
args | Raycast parameters |
Implemented in KS.Reactor.Client.Unity.ksPhysicsAdaptor.
|
pure virtual |
Raycast query that finds the nearest hit.
args | Raycast parameters |
hit | Set to the nearest hit. |
Implemented in KS.Reactor.Client.Unity.ksPhysicsAdaptor.
List<ksSweepResult> KS.Reactor.ksBasePhysics.Sweep | ( | ksIEntity | entity, |
ksVector3 | direction, | ||
float | distance, | ||
bool | includeOverlaps = false , |
||
ksQueryFlags | flags = ksQueryFlags.DEFAULT , |
||
uint | groupMask = 0xffffffff , |
||
uint | maxResults = 255 |
||
) |
Entity sweep using the current position and rotation as starting points.
entity | Entity. |
direction | Direction vector. |
distance | Ray distance. |
includeOverlaps | Include entities that overlap at the origin. |
flags | Bit flags for filtering static, dynamic, and first hit. |
groupMask | Bit mask of collsion groups. |
maxResults | Unused |
List<ksSweepResult> KS.Reactor.ksBasePhysics.Sweep | ( | ksIEntity | entity, |
ksVector3 | origin, | ||
ksQuaternion | rotation, | ||
ksVector3 | direction, | ||
float | distance, | ||
bool | excludeSelf = true , |
||
bool | includeOverlaps = false , |
||
ksQueryFlags | flags = ksQueryFlags.DEFAULT , |
||
uint | groupMask = 0xffffffff , |
||
uint | maxResults = 255 |
||
) |
Entity sweep.
entity | Entity. |
origin | Origin point. |
rotation | Entity orientation. |
direction | Direction vector. |
distance | Sweep distance. |
excludeSelf | Exclude this entity in the returned results. |
includeOverlaps | Include entities that overlap at the origin. |
flags | Bit flags for filtering static, dynamic, and first hit. |
groupMask | Bit mask of collsion groups. |
maxResults | Unused |
List<ksSweepResult> KS.Reactor.ksBasePhysics.Sweep | ( | ksShape | shape, |
ksVector3 | origin, | ||
ksQuaternion | rotation, | ||
ksVector3 | direction, | ||
float | distance, | ||
bool | includeOverlaps = false , |
||
ksQueryFlags | flags = ksQueryFlags.DEFAULT , |
||
uint | groupMask = 0xffffffff , |
||
uint | maxResults = 255 |
||
) |
Shape sweep.
shape | Primitive or convex shape. |
origin | Origin point. |
rotation | Shape orientation. |
direction | Direction vector. |
distance | Sweep distance. |
includeOverlaps | Include entities that overlap at the origin. |
flags | Bit flags for filtering static, dynamic, and first hit. |
groupMask | Bit mask of collsion groups. |
maxResults | Unused |
|
pure virtual |
Sweep query that returns the nearest blocking hit and any touching hits before the blocking hit.
args | Sweep parameters |
Implemented in KS.Reactor.Client.Unity.ksPhysicsAdaptor.
bool KS.Reactor.ksBasePhysics.SweepAndSlide | ( | ksSweepSlideParams | args, |
out ksVector3 | position | ||
) |
Does sweep-and-slide movement.
When a sweep hits something, the remaining movement vector is projected onto the plane perpendicuar to the surface normal to get a new movement vector which is used to sweep recursively.
args | Sweep parameters |
position | Position at the end of the sweep-and-slide movement. |
|
pure virtual |
Sweep query that checks if anything was hit.
args | Sweep arguments |
Implemented in KS.Reactor.Client.Unity.ksPhysicsAdaptor.
|
pure virtual |
Sweep query that finds the nearest hit.
args | Sweep arguments |
hit | Set to the nearest hit. |
Implemented in KS.Reactor.Client.Unity.ksPhysicsAdaptor.
|
virtual |
Apply all transform and rigidbody changes to the physics simulation now rather than waiting for the next simulation step.
Reimplemented in KS.Reactor.Client.Unity.ksPhysicsAdaptor.
|
virtual |
Apply entity transform updates to the physics simulation now rather than waiting for the next simulation step.
Reimplemented in KS.Reactor.Client.Unity.ksPhysicsAdaptor.
|
getset |
If true, transform changes are synced with the physics system and stale inertia tensors and centers of mass are recalculated automatically before any physics queries.
If this is false, changes are only synced during the simulation step, and you are responsible for calling Sync if you want to sync changes sooner.
|
get |
Gets the current gravity in the scene.