Get surface normal whitout raycast?

Is it possible to get a surface normal whitout using raycast?

I dont want to use raycast because they can be laggy if you do a lot of them and, if i dont optimise my game it will be unplayable with the number of necessary heavy computing that would need to be done.

I looked 2 entire day in the dev hub and i did manage to find something but it only return a “Straight” normal Ex : Supposed to be 0.4, 0.6, 0 but return 0, 1, 0.

1 Like

Sure, if you know that it’s e.g. the right face of a part. Could you describe what you need the surface normal of?

Anyway, if you want to get the surface normal of the right side of a Part, that’s just the same as the CFrame.RightVector of the Part.

Anyway, if you do a raycast with just the one part you’re interested in in a whitelist, it’s not going to be a performance issue.

For your 5 first line, if the surface at a position is not straight what do i do? And for you 2 last line, it would be a perfomance issue when it would be running 200 time per second because a lot of thing get hit.

Do you mean if the surface of a mesh is not perpendicular to any of the six faces of the MeshPart? In the general case you can only do that in Roblox by doing raycasts.

That’s only around 4 times per frame (@ 60 fps). Unless you’ve tried it and you’re sure that’s a problem, I wouldn’t dismiss it as an option.

For your first “reply”, yes that exactly what i meant. And for you last, if you use the touched event with anything it will lag but i did not test it. And just a last question, so in my game because of the delay of the touched event the part bounce of and then the event execute so when i try to get the “hit point” using union, it return an error saying that im referencing nil or nothing because both part are not touching one another. Do you think you have a solution cause that a pretty huge problem that i tried figuring out for a week.