Class Physics
- Namespace
- AO
- Assembly
- CoreAssembly.dll
Physics is a core engine system to work with the 2D physics system.
public static class Physics
- Inheritance
-
Physics
- Inherited Members
Methods
BoxCast(Vector2, Vector2, Vector2, Vector2, float, ref RaycastHit[])
Cast a box through space and check for collisions.
public static int BoxCast(Vector2 origin, Vector2 center, Vector2 size, Vector2 direction, float distance, ref Physics.RaycastHit[] hits)
Parameters
originVector2Start point of the box cast
centerVector2Center of the box
sizeVector2Size of the box
directionVector2Direction to cast in
distancefloatHow far to cast
hitsRaycastHit[]
Returns
- int
If something was hit
BoxCastWithWhitelist(Vector2, Vector2, Vector2, Vector2, float, Entity[], Entity[], ref RaycastHit[])
Cast a box through space and check for collisions, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static int BoxCastWithWhitelist(Vector2 origin, Vector2 center, Vector2 size, Vector2 direction, float distance, Entity[] whitelist, Entity[] blacklist, ref Physics.RaycastHit[] hits)
Parameters
originVector2Start point of the box cast
centerVector2Center of the box
sizeVector2Size of the box
directionVector2Direction to cast in
distancefloatHow far to cast
whitelistEntity[]Which entities to check against
blacklistEntity[]Which entities to ignore
hitsRaycastHit[]
Returns
- int
If something was hit
BoxCastWithWhitelist(Vector2, Vector2, Vector2, Vector2, float, List<Entity>, List<Entity>, ref RaycastHit[])
Cast a box through space and check for collisions, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static int BoxCastWithWhitelist(Vector2 origin, Vector2 center, Vector2 size, Vector2 direction, float distance, List<Entity> whitelist, List<Entity> blacklist, ref Physics.RaycastHit[] hits)
Parameters
originVector2Start point of the box cast
centerVector2Center of the box
sizeVector2Size of the box
directionVector2Direction to cast in
distancefloatHow far to cast
whitelistList<Entity>Which entities to check against
blacklistList<Entity>Which entities to ignore
hitsRaycastHit[]
Returns
- int
If something was hit
CircleCast(Vector2, float, Vector2, float, out RaycastHit)
Cast a circle through space and check for collisions.
public static bool CircleCast(Vector2 origin, float radius, Vector2 direction, float distance, out Physics.RaycastHit hit)
Parameters
originVector2Start point of the circle
radiusfloatRadius of the circle
directionVector2Direction to cast in
distancefloatHow far to cast
hitPhysics.RaycastHitInformation about what was hit
Returns
- bool
If something was hit
CircleCast(Vector2, float, Vector2, float, ref RaycastHit[])
Cast a circle through space and check for collisions.
public static int CircleCast(Vector2 origin, float radius, Vector2 direction, float distance, ref Physics.RaycastHit[] hits)
Parameters
originVector2Start point of the circle
radiusfloatRadius of the circle
directionVector2Direction to cast in
distancefloatHow far to cast
hitsRaycastHit[]
Returns
- int
If something was hit
CircleCastWithWhitelist(Vector2, float, Vector2, float, Entity[], Entity[], out RaycastHit)
Cast a circle through space and check for collisions, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static bool CircleCastWithWhitelist(Vector2 origin, float radius, Vector2 direction, float distance, Entity[] whitelist, Entity[] blacklist, out Physics.RaycastHit hit)
Parameters
originVector2Start point of the circle
radiusfloatRadius of the circle
directionVector2Direction to cast in
distancefloatHow far to cast
whitelistEntity[]Which entities to check against
blacklistEntity[]Which entities to ignore
hitPhysics.RaycastHitInformation about what was hit
Returns
- bool
If something was hit
CircleCastWithWhitelist(Vector2, float, Vector2, float, Entity[], Entity[], ref RaycastHit[])
Cast a circle through space and check for collisions, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static int CircleCastWithWhitelist(Vector2 origin, float radius, Vector2 direction, float distance, Entity[] whitelist, Entity[] blacklist, ref Physics.RaycastHit[] hits)
Parameters
originVector2Start point of the circle
radiusfloatRadius of the circle
directionVector2Direction to cast in
distancefloatHow far to cast
whitelistEntity[]Which entities to check against
blacklistEntity[]Which entities to ignore
hitsRaycastHit[]
Returns
- int
If something was hit
CircleCastWithWhitelist(Vector2, float, Vector2, float, List<Entity>, List<Entity>, out RaycastHit)
Cast a circle through space and check for collisions, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static bool CircleCastWithWhitelist(Vector2 origin, float radius, Vector2 direction, float distance, List<Entity> whitelist, List<Entity> blacklist, out Physics.RaycastHit hit)
Parameters
originVector2Start point of the circle
radiusfloatRadius of the circle
directionVector2Direction to cast in
distancefloatHow far to cast
whitelistList<Entity>Which entities to check against
blacklistList<Entity>Which entities to ignore
hitPhysics.RaycastHitInformation about what was hit
Returns
- bool
If something was hit
CircleCastWithWhitelist(Vector2, float, Vector2, float, List<Entity>, List<Entity>, ref RaycastHit[])
Cast a circle through space and check for collisions, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static int CircleCastWithWhitelist(Vector2 origin, float radius, Vector2 direction, float distance, List<Entity> whitelist, List<Entity> blacklist, ref Physics.RaycastHit[] hits)
Parameters
originVector2Start point of the circle
radiusfloatRadius of the circle
directionVector2Direction to cast in
distancefloatHow far to cast
whitelistList<Entity>Which entities to check against
blacklistList<Entity>Which entities to ignore
hitsRaycastHit[]
Returns
- int
If something was hit
OverlapBox(Vector2, Vector2, ref RaycastHit[])
Check if there is anything overlapping a box.
public static int OverlapBox(Vector2 center, Vector2 size, ref Physics.RaycastHit[] hits)
Parameters
centerVector2sizeVector2hitsRaycastHit[]
Returns
OverlapBoxWithWhitelist(Vector2, Vector2, Entity[], Entity[], ref RaycastHit[])
Check if there is anything overlapping a box, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static int OverlapBoxWithWhitelist(Vector2 center, Vector2 size, Entity[] whitelist, Entity[] blacklist, ref Physics.RaycastHit[] hits)
Parameters
centerVector2sizeVector2whitelistEntity[]blacklistEntity[]hitsRaycastHit[]
Returns
OverlapBoxWithWhitelist(Vector2, Vector2, List<Entity>, List<Entity>, ref RaycastHit[])
Check if there is anything overlapping a box, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static int OverlapBoxWithWhitelist(Vector2 center, Vector2 size, List<Entity> whitelist, List<Entity> blacklist, ref Physics.RaycastHit[] hits)
Parameters
Returns
OverlapCircle(Vector2, float)
Check if there is anything overlapping a circle.
public static bool OverlapCircle(Vector2 origin, float radius)
Parameters
Returns
- bool
If something was hit
OverlapCircle(Vector2, float, ref RaycastHit[])
Check if there is anything overlapping a circle.
public static int OverlapCircle(Vector2 origin, float radius, ref Physics.RaycastHit[] hits)
Parameters
originVector2Center of the circle
radiusfloatRadius of the circle
hitsRaycastHit[]
Returns
- int
If something was hit
OverlapCircleWithWhitelist(Vector2, float, Entity[], Entity[])
Check if there is anything overlapping a circle, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static bool OverlapCircleWithWhitelist(Vector2 origin, float radius, Entity[] whitelist, Entity[] blacklist)
Parameters
originVector2Center of the circle
radiusfloatRadius of the circle
whitelistEntity[]Which entities to check against
blacklistEntity[]Which entities to ignore
Returns
- bool
If something was hit
OverlapCircleWithWhitelist(Vector2, float, Entity[], Entity[], ref RaycastHit[])
Check if there is anything overlapping a circle, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static int OverlapCircleWithWhitelist(Vector2 origin, float radius, Entity[] whitelist, Entity[] blacklist, ref Physics.RaycastHit[] hits)
Parameters
originVector2Center of the circle
radiusfloatRadius of the circle
whitelistEntity[]Which entities to check against
blacklistEntity[]Which entities to ignore
hitsRaycastHit[]
Returns
- int
If something was hit
OverlapCircleWithWhitelist(Vector2, float, List<Entity>, List<Entity>)
Check if there is anything overlapping a circle, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static bool OverlapCircleWithWhitelist(Vector2 origin, float radius, List<Entity> whitelist, List<Entity> blacklist)
Parameters
originVector2Center of the circle
radiusfloatRadius of the circle
whitelistList<Entity>Which entities to check against
blacklistList<Entity>Which entities to ignore
Returns
- bool
If something was hit
OverlapCircleWithWhitelist(Vector2, float, List<Entity>, List<Entity>, ref RaycastHit[])
Check if there is anything overlapping a circle, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static int OverlapCircleWithWhitelist(Vector2 origin, float radius, List<Entity> whitelist, List<Entity> blacklist, ref Physics.RaycastHit[] hits)
Parameters
originVector2Center of the circle
radiusfloatRadius of the circle
whitelistList<Entity>Which entities to check against
blacklistList<Entity>Which entities to ignore
hitsRaycastHit[]
Returns
- int
If something was hit
OverlapPoint(Vector2, ref RaycastHit[])
Check if there is anything overlapping a point.
public static int OverlapPoint(Vector2 point, ref Physics.RaycastHit[] hits)
Parameters
pointVector2hitsRaycastHit[]
Returns
OverlapPointWithWhitelist(Vector2, Entity[], Entity[], ref RaycastHit[])
Check if there is anything overlapping a point, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static int OverlapPointWithWhitelist(Vector2 point, Entity[] whitelist, Entity[] blacklist, ref Physics.RaycastHit[] hits)
Parameters
pointVector2whitelistEntity[]blacklistEntity[]hitsRaycastHit[]
Returns
OverlapPointWithWhitelist(Vector2, List<Entity>, List<Entity>, ref RaycastHit[])
Check if there is anything overlapping a point, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static int OverlapPointWithWhitelist(Vector2 point, List<Entity> whitelist, List<Entity> blacklist, ref Physics.RaycastHit[] hits)
Parameters
Returns
Raycast(Vector2, Vector2, float, out RaycastHit)
Raycast from origin to origin + direction * distance.
public static bool Raycast(Vector2 origin, Vector2 direction, float distance, out Physics.RaycastHit hit)
Parameters
originVector2Start point of the ray
directionVector2Direction of the ray
distancefloatHow far the ray should go
hitPhysics.RaycastHitThe first entity hit
Returns
- bool
If something was hit
Raycast(Vector2, Vector2, float, ref RaycastHit[])
Raycast from origin to origin + direction * distance.
public static int Raycast(Vector2 origin, Vector2 direction, float distance, ref Physics.RaycastHit[] hits)
Parameters
originVector2Start point of the ray
directionVector2Direction of the ray
distancefloatHow far the ray should go
hitsRaycastHit[]
Returns
- int
If something was hit
RaycastWithWhitelist(Vector2, Vector2, float, Entity[], Entity[], out RaycastHit)
Raycast from origin to origin + direction * distance, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static bool RaycastWithWhitelist(Vector2 origin, Vector2 direction, float distance, Entity[] whitelist, Entity[] blacklist, out Physics.RaycastHit hit)
Parameters
originVector2Start point of the ray
directionVector2Direction of the ray
distancefloatHow far the ray should go
whitelistEntity[]Which entities to check against
blacklistEntity[]Which entities to ignore
hitPhysics.RaycastHitThe first entity hit
Returns
RaycastWithWhitelist(Vector2, Vector2, float, Entity[], Entity[], ref RaycastHit[])
Raycast from origin to origin + direction * distance, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static int RaycastWithWhitelist(Vector2 origin, Vector2 direction, float distance, Entity[] whitelist, Entity[] blacklist, ref Physics.RaycastHit[] hits)
Parameters
originVector2Start point of the ray
directionVector2Direction of the ray
distancefloatHow far the ray should go
whitelistEntity[]Which entities to check against
blacklistEntity[]Which entities to ignore
hitsRaycastHit[]
Returns
RaycastWithWhitelist(Vector2, Vector2, float, List<Entity>, List<Entity>, out RaycastHit)
Raycast from origin to origin + direction * distance, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static bool RaycastWithWhitelist(Vector2 origin, Vector2 direction, float distance, List<Entity> whitelist, List<Entity> blacklist, out Physics.RaycastHit hit)
Parameters
originVector2Start point of the ray
directionVector2Direction of the ray
distancefloatHow far the ray should go
whitelistList<Entity>Which entities to check against
blacklistList<Entity>Which entities to ignore
hitPhysics.RaycastHitThe first entity hit
Returns
RaycastWithWhitelist(Vector2, Vector2, float, List<Entity>, List<Entity>, ref RaycastHit[])
Raycast from origin to origin + direction * distance, but only hit entities in the whitelist and ignore entities in the blacklist. A null whitelist means include all entities. An empty whitelist means include no entities. A null or empty blacklist means ignore no entities. If an entity is in both the blacklist and the whitelist the blacklist takes priority, so that entity will be skipped.
public static int RaycastWithWhitelist(Vector2 origin, Vector2 direction, float distance, List<Entity> whitelist, List<Entity> blacklist, ref Physics.RaycastHit[] hits)
Parameters
originVector2Start point of the ray
directionVector2Direction of the ray
distancefloatHow far the ray should go
whitelistList<Entity>Which entities to check against
blacklistList<Entity>Which entities to ignore
hitsRaycastHit[]