struct
Godot::PhysicsHit3D
- Godot::PhysicsHit3D
- Struct
- Value
- Object
Overview
Strongly-typed 3D physics intersection hit result.
Encapsulates collision location, surface normal, and hit object reference with built-in dead-pointer protection.
Usage Example:
if hit = raycast(Vector3.forward, distance: 20.0)
if destructible = hit.collider.as?(DestructibleProp)
destructible.shatter!
end
end
Defined in:
libgodot/extensions/physics.crConstructors
Instance Method Summary
-
#collider : Godot::Object | Nil
Returns the hit collider if alive, or
nilif already freed or absent. -
#normal : Vector3
The surface normal vector at the intersection point
-
#point : Vector3
The global intersection coordinate
-
#rid : RID
The RID of the colliding physics body or shape
-
#shape : Int32
The shape index within the colliding body
Instance methods inherited from class Object
try?(&)try? try?
Constructor Detail
def self.new(point : Vector3, normal : Vector3, collider : Godot::Object | Nil = nil, rid : RID = RID.new, shape : Int32 = 0)
#
Instance Method Detail
Returns the hit collider if alive, or nil if already freed or absent.
Dynamically verifies #alive? to guarantee dead-pointer safety.
Pair with .as?(Type) for type-safe dispatch.