How to rotate a LookVector around origin?

I need to know this so I can find how to raycast in a cone shape; is there a way I can do this?


1 Like

May I ask what are you trying to do with a cone-shaped raycast? Perhaps you can just use a cone shaped part for a hitbox and use :GetPartsInPart instead?

I’m trying to make a melee system that uses raycasts for hit detection. By cone-shaped, I mean this:

(red being the origin again)
And I’ll raycast multiple times to get the parts (players) in that general area.
I’m currently using a single ray, but I’m doing this so it doesn’t feel clunky.

Refer to my original suggestion of using spatial queries

To achieve what you want, check out this other thread:

1 Like

If it’s just about the vector, you can get the direction in a 2D plane by using the sine and cosine functions. You give it an angle, and cosine and sine give you the X and Y coordinates respectively. Since the 2D vector formed by these two numbers is of length 1, you can use it as a direction.