RaycastHit2D
APJS Script API reference for the RaycastHit2D class.
| Type | Name | Interface Description |
|---|---|---|
| Variables | collider: Collider2D | null | • Function: The Collider2D component that the ray hit. This is null if the hit SceneObject does not expose a Collider2D component through APJS. |
| Variables | colliderObject: SceneObject | null | • Function: The SceneObject that owns the hit collider. This is null if APJS cannot resolve the hit collider back to a SceneObject. |
| Variables | normal: Vector2f | • Function: World-space surface normal at the hit point. |
| Variables | point: Vector2f | • Function: World-space point where the ray touched this hit. |
| Functions | constructor(point: Vector2f, normal: Vector2f, collider: Collider2D | null, colliderObject: SceneObject | null) |
Examples
constructor(point: Vector2f, normal: Vector2f, collider: Collider2D | null, colliderObject: SceneObject | null)
let obj = new APJS.RaycastHit2D();
Use Case
@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use RaycastHit2D here
}
onUpdate(deltaTime: number) {
}
}