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

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

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

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