# RaycastResult

## Overview

RaycastResult is a data type that contains result information about what target a raycast actually collided with. It is returned when a WorldRoot:Raycast call succeeds and provides various data needed for raycast result analysis, such as collision point, collided object, and surface information.

## Constructors

## Properties

### BlockingHit

`boolean`

Indicates whether the raycast hit a blocking object.

#### Code Samples

### Distance

`number`

Represents the straight-line distance from where the Raycast started to where the collision occurred.

#### Code Samples

```lua
local Workspace = game:GetService("Workspace")

local Origin = Vector3.new(0, 50, -0)
local Direction = Vector3.new(0, 0, -3000)

local Result = Workspace:Raycast(Origin, Direction)
if Result then
   print("Hit distance:", Result.Distance)
end
```

### Instance

`Instance`

Represents the target object the Raycast collided with.

#### Code Samples

```lua
local Workspace = game:GetService("Workspace")

local Origin = Vector3.new(0, 50, -0)
local Direction = Vector3.new(0, 0, -3000)

local Result = Workspace:Raycast(Origin, Direction)
if Result then
   print("Hit instance:", Result.Instance.Name)
end
```

### Normal

`Vector3`

A vector representing the direction the surface that the Raycast collided with is facing. It is based on the direction perpendicular to the plane at the collision point, and used in subsequent operations such as reflection processing, angle calculation, and surface direction detection.

#### Code Samples

```lua
local Workspace = game:GetService("Workspace")

local Origin = Vector3.new(0, 50, -0)
local Direction = Vector3.new(0, 0, -3000)

local Result = Workspace:Raycast(Origin, Direction)
if Result then
   print("Surface normal:", Result.Normal)
end
```

### Position

`Vector3`

Represents the position where the Raycast collided with the target as coordinates in world space.

#### Code Samples

```lua
local Workspace = game:GetService("Workspace")

local Origin = Vector3.new(0, 50, -0)
local Direction = Vector3.new(0, 0, -3000)

local Result = Workspace:Raycast(Origin, Direction)
if Result then
   print("Hit position:", Result.Position)
end
```

## Methods

## Events

## See also

{% content-ref url="/pages/A9RxgYKTmNNgDRmjtQwe" %}
[WorldRoot](/development/api-reference/classes/worldroot.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.overdare.com/development/api-reference/datatype/raycastresult.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
