astraIboy
(The Batman)
December 6, 2022, 6:27pm
#1
So basically the part that i’m raycasting too is slightly rotated and I want to get the surface normal, and of course I get it but it’s all wacky and I have no clue which side im raycasting on
the code
print(raycast.Normal)
the part
I tried normalizing it but that didnt work…
1 Like
azqjanna
(azqjanna)
December 6, 2022, 8:38pm
#2
You need to transform the normal from world space to local space. Raycast result normals are in world space:
local localNormal = part.CFrame:VectorToObjectSpace(normal)
1 Like
astraIboy
(The Batman)
December 7, 2022, 3:04pm
#3
Alright I tried that but it just makes it worse, thank you though
whats the issue exactly? you’re output seems to be the normal which is essentially the opposite direction from the actual ray cast
astraIboy
(The Batman)
December 7, 2022, 4:34pm
#5
Yeah but I have no clue which side it is im raycasting onto…
Usually Vector3.new(0,0,-1)
would be the front but I cant even figure out which side it is with those random values
msix29
(msix29)
December 7, 2022, 4:40pm
#6
You can try to use math.Round()
1 Like
astraIboy
(The Batman)
December 7, 2022, 4:42pm
#7
On every single axis of the surface normal?
azqjanna
(azqjanna)
December 7, 2022, 4:42pm
#8
What do you mean, that looks correct. That’s the front surface (negative Z)
astraIboy
(The Batman)
December 7, 2022, 4:45pm
#10
i literally tried it on the left side of the part and it still made the Z -1
astraIboy
(The Batman)
December 7, 2022, 4:46pm
#11
Welp i feel stupid af, rounding it worked, the numbers were just so wacky i didnt think this worked
@azqjanna @msix29 thanks guys i appreciate it
1 Like
system
(system)
Closed
December 21, 2022, 4:46pm
#12
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.