[HELP NEEDED URGENT VERY URGENT PLEASE HELP] How Do I Make This Raycast go in a Circular Motion

I have a raycast, and I am trying to make it go in a circular motion by using a vector3 value and adding on to it

	local Direction = (LookVector * 2000)+OffsetOrientation
	local Cast = workspace:Raycast(Origin, Direction)
	OffsetOrientation = Vector3.new(OffsetOrientation.X+CurveAmount,OffsetOrientation.Y,OffsetOrientation.Z)

That’s the code I have, which gives me this result
image

It raycasts from 0,17.5,0 from this part

I am trying to make the motion go like this (but as the vector3)
image


except instead of turning 90 degrees, it turns 5 degrees every repeat

local SideRotation = 45 local CurveAmount = 5

yet I do not have the scripting knowledge to make it do that

2 Likes

I would help however, the second i read [HELP NEEDED URGENT VERY URGENT PLEASE HELP] my reading time ran out, Sorry lad.

3 Likes

Ok, It Is understandable

1 Like

Hate to be a downer but what you are trying to do simply is not possible. A raycast can only be fired in a straight line, period.

3 Likes

I mean that casting a raycast in a repeating function and with each cast, it adds on an orientation offset that gets altered/added/subtracted to each time it repeats

1 Like
local Direction = OffsetOrientation.LookVector * 2000
local Cast = workspace:Raycast(Origin, Direction)
OffsetOrientation = CFrame.Angles((OffsetOrientation.X+CurveAmount) * math.pi/180, OffsetOrientation.Y * math.pi/180, OffsetOrientation.Z * math.pi/180)

Something like this?

1 Like

I get Error:

invalid argument #1 (CFrame expected, got Vector3)

1 Like

Can you show more of your code?

1 Like

The OfffsetOreientation is a Vector3

1 Like

What line did you get the error on? Make sure you change

local Direction = (LookVector * 2000)+OffsetOrientation

to

local Direction = OffsetOrientation.LookVector * 2000
1 Like

If I changed it to that, then it wouldn’t cast the raycast towards the parts lookvector, aka where it’s facing, instead it would cast to Offset Orientation times two thousand

1 Like

The line I changed when you suggested the new code it errored

1 Like

I’m not exactly sure what you are trying to do, then.

1 Like

It is hard to Explain

Like example, if you had a laser and you made a circle with it, thats what im trying to do, but with raycasts in roblox

1 Like

Try replacing the direction line with

local Direction = (OffsetOrientation * [Part raycasting from].Orientation).LookVector * 2000

You might want to change the third line in the loop to

OffsetOrientation = CFrame.Angles(OffsetOrientation:ToEulerAngles() + CurveAmount * math.pi/180, 0, 0)

It would help if you could describe what you are trying to do.

1 Like

Ok I tried and it errored LookVector is not a valid memeber of Vector3

This Code Errored

1 Like

Can you please paste the errors you get

1 Like

LookVector is not a valid member of Vector3 -

1 Like

Change the line initializing OffsetOrientation to a Vector3 to instead initialize it to an identity CFrame

1 Like

what do you mean i do not understand

1 Like