Table of Contents

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

origin Vector2

Start point of the box cast

center Vector2

Center of the box

size Vector2

Size of the box

direction Vector2

Direction to cast in

distance float

How far to cast

hits RaycastHit[]

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

origin Vector2

Start point of the box cast

center Vector2

Center of the box

size Vector2

Size of the box

direction Vector2

Direction to cast in

distance float

How far to cast

whitelist Entity[]

Which entities to check against

blacklist Entity[]

Which entities to ignore

hits RaycastHit[]

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

origin Vector2

Start point of the box cast

center Vector2

Center of the box

size Vector2

Size of the box

direction Vector2

Direction to cast in

distance float

How far to cast

whitelist List<Entity>

Which entities to check against

blacklist List<Entity>

Which entities to ignore

hits RaycastHit[]

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

origin Vector2

Start point of the circle

radius float

Radius of the circle

direction Vector2

Direction to cast in

distance float

How far to cast

hit Physics.RaycastHit

Information 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

origin Vector2

Start point of the circle

radius float

Radius of the circle

direction Vector2

Direction to cast in

distance float

How far to cast

hits RaycastHit[]

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

origin Vector2

Start point of the circle

radius float

Radius of the circle

direction Vector2

Direction to cast in

distance float

How far to cast

whitelist Entity[]

Which entities to check against

blacklist Entity[]

Which entities to ignore

hit Physics.RaycastHit

Information 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

origin Vector2

Start point of the circle

radius float

Radius of the circle

direction Vector2

Direction to cast in

distance float

How far to cast

whitelist Entity[]

Which entities to check against

blacklist Entity[]

Which entities to ignore

hits RaycastHit[]

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

origin Vector2

Start point of the circle

radius float

Radius of the circle

direction Vector2

Direction to cast in

distance float

How far to cast

whitelist List<Entity>

Which entities to check against

blacklist List<Entity>

Which entities to ignore

hit Physics.RaycastHit

Information 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

origin Vector2

Start point of the circle

radius float

Radius of the circle

direction Vector2

Direction to cast in

distance float

How far to cast

whitelist List<Entity>

Which entities to check against

blacklist List<Entity>

Which entities to ignore

hits RaycastHit[]

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

center Vector2
size Vector2
hits RaycastHit[]

Returns

int

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

center Vector2
size Vector2
whitelist Entity[]
blacklist Entity[]
hits RaycastHit[]

Returns

int

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

center Vector2
size Vector2
whitelist List<Entity>
blacklist List<Entity>
hits RaycastHit[]

Returns

int

OverlapCircle(Vector2, float)

Check if there is anything overlapping a circle.

public static bool OverlapCircle(Vector2 origin, float radius)

Parameters

origin Vector2

Center of the circle

radius float

Radius of the circle

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

origin Vector2

Center of the circle

radius float

Radius of the circle

hits RaycastHit[]

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

origin Vector2

Center of the circle

radius float

Radius of the circle

whitelist Entity[]

Which entities to check against

blacklist Entity[]

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

origin Vector2

Center of the circle

radius float

Radius of the circle

whitelist Entity[]

Which entities to check against

blacklist Entity[]

Which entities to ignore

hits RaycastHit[]

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

origin Vector2

Center of the circle

radius float

Radius of the circle

whitelist List<Entity>

Which entities to check against

blacklist List<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

origin Vector2

Center of the circle

radius float

Radius of the circle

whitelist List<Entity>

Which entities to check against

blacklist List<Entity>

Which entities to ignore

hits RaycastHit[]

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

point Vector2
hits RaycastHit[]

Returns

int

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

point Vector2
whitelist Entity[]
blacklist Entity[]
hits RaycastHit[]

Returns

int

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

point Vector2
whitelist List<Entity>
blacklist List<Entity>
hits RaycastHit[]

Returns

int

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

origin Vector2

Start point of the ray

direction Vector2

Direction of the ray

distance float

How far the ray should go

hit Physics.RaycastHit

The 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

origin Vector2

Start point of the ray

direction Vector2

Direction of the ray

distance float

How far the ray should go

hits RaycastHit[]

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

origin Vector2

Start point of the ray

direction Vector2

Direction of the ray

distance float

How far the ray should go

whitelist Entity[]

Which entities to check against

blacklist Entity[]

Which entities to ignore

hit Physics.RaycastHit

The first entity hit

Returns

bool

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

origin Vector2

Start point of the ray

direction Vector2

Direction of the ray

distance float

How far the ray should go

whitelist Entity[]

Which entities to check against

blacklist Entity[]

Which entities to ignore

hits RaycastHit[]

Returns

int

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

origin Vector2

Start point of the ray

direction Vector2

Direction of the ray

distance float

How far the ray should go

whitelist List<Entity>

Which entities to check against

blacklist List<Entity>

Which entities to ignore

hit Physics.RaycastHit

The first entity hit

Returns

bool

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

origin Vector2

Start point of the ray

direction Vector2

Direction of the ray

distance float

How far the ray should go

whitelist List<Entity>

Which entities to check against

blacklist List<Entity>

Which entities to ignore

hits RaycastHit[]

Returns

int