Raycast not rotating with object / always have raycast ray a certain way no matter what?

Currently this happens in Unity.

alt text

How can I accomplish this?

alt text

Have you tried using -Vector3.up?

Example something like this, Physics.Raycast (objectPosition, -Vector3.up, out hit, 50.0f);

This isn’t a raycast issue. It’s really about local vs. world coords. Raycasts fire whichever direction you ask, so you have to know how to ask for a certain direction.

transform.forward spins with the player. So if you use it for a raycast direction, the raycast will spin with you. It’s known as your “local” forward. Vector3.down, as Shane suggests, is always real world down; doesn’t spin with you; so doesn’t care which way you’re facing.