The title explains it all, i have been using raycasting for this but it seems buggy and doesn’t work at all in some scenarios, i would like to know how to get these two values using the touched event of a basepart
How would i get the hitposition and surface normal of a basepart when it collides with another basepart
You can’t. That’s just not built into Roblox.
Your best bet is probably using EgoMoose’s RotatedRegion3D module that lets you do part-part and part-point collision detection. The older version also has a way of getting the minimum separating vector, or MSV, which tells you the shortest vector you can move one of the parts to get them to stop intersecting. AFAIK the newer version uses faster math but doesn’t have the MSV feature.
RotatedRegion3 (new version). The old version is… somewhere in the Toolbox? Not sure, let me know if you can’t find it and I’ll do some digging.
Can you tell us a bit more about your use case? Maybe there’s another way of doing what you want.
I made a blood script, where a player dies, small droplets shoot to nearby parts and spread onto them once they hit, this requires raycasting in order to get the hitposition and surface normal of the part they hit, however, problem is raycasting is a bit late sometimes resulting in it not working, let me know if you can help, thanks
It’s definitely possible to make a “projectile raycast” that simulates a particle moving through space, but it’s not the easiest thing in the world. A good challenge if you feel like it.
If you want help doing that it’d make most sense to make a new post about that specifically
There’s a module called FastCast that seems to do what you want, but I haven’t used it so I can’t say how good it is. Seems popular tho.
thanks, I will try it and notify you if it works
It seems that this just might solve my problem, after learning some functions of this module, I will hopefully be able to set this up with my code, Thanks.