Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is it possible to raycast from a vector3 point to another vector3?

Let's say I want to RayCast from a character to another character. I know you have to put a direction in the second parameter but is there some way I can do it where it goes directly to a vector3 point?

Example of what I want but what is not possible:

local V1 = Vector3.new(0,0,5)
local V2 = Vector3.new(5,2,6)
workspace:Raycast(V1, V2) -- So it goes from V1 to V2

2 comments

0

So, you want to raycast character to character or vector3 point to vector3 point?

0

Just vector3 to vector3.

1 answer

✓ Accepted answer

The Introduction to Raycasting page on the devhub has a formula to calcuate direction from origin and destination. rayDirection = rayDestination - rayOrigin

1 comment

0

Thank you so much!

This discussion is preserved as it was. New answers, comments, and votes are closed.