Are you saying you want to rotate a vector along it’s y-axis?
Or that you want to rotate a vector based on the rotation of a part?
You probably could use the part’s CFrame to do what you want, if I am understanding the question.
So, using the example code you gave, you could try this:
local RotatedVector = raycast.Instance.CFrame.Rotation * NormalOffset
If that doesn’t give you result you are expecting, you can also try:
local RotatedVector = raycast.Instance.CFrame.Rotation:Inverse() * NormalOffset
But in the event that I misunderstood what you were asking about, you may need somthing slightly different.
Because part of me thinks what you are doing is using raycasts to align an object to the surface of another object. But you also want to be able to specify the rotation of that object around the raycast normal, as an axis.
So to visualise what I just said, it’s like a cube spinning on a table. The axis of rotation of the cube is based on the normal of the surface (the arrow pointing away from the surface).
This is what im trying to accomplish,
I used your code that you stated and it seemingly worked on only 2 axis-s as intended
works here
and here
then here it just kinda goes into the stud, not exactly sure how to fix this, Using :Inverse()just had the same results but switched to the z axis instead of the x
Heres the code i used
local RotSize = rayc.Instance.CFrame.Rotation * (ClientPart.Size/2)
local Offset = RotSize * rayc.Normal
NewCF += Offset
(Edit)
Above was tested on parts with a 90 rotation
Parts with a 180 rotation have both offsets go into the part
and -90 seems just to be the inverse of the 90 rotation