> For the complete documentation index, see [llms.txt](https://sunfish-studios.gitbook.io/main/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sunfish-studios.gitbook.io/main/vehicle/main-components/fishing-caster.md).

# Fishing Caster

Handles the logic for casting a fishing line into water — finds valid spots, avoids obstacles, and works with your bobber system. Great for fishing minigames or open-world fishing mechanics.

> ✅ **Requires**: A `BobberController` component on the same GameObject.

***

#### 🔧 Inspector Settings

**⚙️ Active**

Toggle whether this caster is enabled.&#x20;

**🎯 Player Radius Casting**

This section controls *where* and *how* the game searches for water in front of the player.

* **Cast Distance**\
  How far forward from the player to start searching. Think: “How far can I cast?”
* **Search Radius**\
  The size of the sphere used to scan for water colliders around the target point.
* **Height Offset**\
  Vertical offset applied to the center of the search sphere. Adjust if your character casts from above or below eye level.
* **Cast Start Height**\
  Where the raycast begins when checking for clear line-of-sight to water. Helps avoid terrain clipping.

**🔄 Cast Bias**

Adds a slight left/right preference to each cast — useful for simulating natural variation or “favoring” one side.

* **Left Bias Strength**\
  Pulls the cast slightly to the left on even casts.
* **Right Bias Strength**\
  Pulls the cast slightly to the right on odd casts.
* **Prefer Closer Spots**\
  If enabled, picks the nearest valid water spot within range. If disabled, picks randomly (good for variety).

**🌊 Water Detection**

Tells Unity what counts as water and what blocks your line.

* **Water Layer**\
  Set this to the layer your water surfaces are on (e.g., “Water”). Default is set automatically if empty.
* **Blocking Layers**\
  Layers that block line-of-sight to water (like terrain, rocks, or walls). Usually “Default” or “Terrain”.

**👁️ Debug**

Enable to see spheres, rays, and hit points drawn in Scene view. Super helpful for tuning distances and avoiding obstructions.

***

#### 📈 Public Methods

**`TryCastToWater(out Vector3 waterHitPoint, out GameObject hitWaterObject)`**

Attempts to find a valid water surface to cast to.

* Returns `true` if a spot is found and unobstructed.
* Sets `waterHitPoint` to the world position where the bobber should land.
* Sets `hitWaterObject` to the actual water GameObject hit (useful for effects or sound triggers).

> 💡 Tip: Call this before triggering your animation or spawning the bobber.

**`InformWaterHit(Vector3 point)`**

Tells the attached `BobberController` where the water was hit. Usually called after `TryCastToWater()` succeeds.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://sunfish-studios.gitbook.io/main/vehicle/main-components/fishing-caster.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
