Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
rabbi99 714 Moderation Voter
3 years ago

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
0
So, you want to raycast character to character or vector3 point to vector3 point? NotTheChara 191 — 3y
0
Just vector3 to vector3. rabbi99 714 — 3y

1 answer

Log in to vote
1
Answered by
zadobyte 692 Moderation Voter
3 years ago

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

0
Thank you so much! rabbi99 714 — 3y
Ad

Answer this question