Skip to main content

RaycastHit2D

APJS Script API reference for the RaycastHit2D class.

TypeNameInterface Description
Variablescollider: 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.

VariablescolliderObject: SceneObject | null

Function: The SceneObject that owns the hit collider. This is null if APJS cannot resolve the hit collider back to a SceneObject.

Variablesnormal: Vector2f

Function: World-space surface normal at the hit point.

Variablespoint: Vector2f

Function: World-space point where the ray touched this hit.

Functionsconstructor(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) {
}
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies