(note that raycasts starting inside a part cannot hit the part, the red circle is the projectile and the blue box is a moving part/player)
things ive tried:
“use shapecasts”: shapecasts have the same problem
“do a spatial query at the projectile position”: i may need RaycastResults.Normal for the projectile, and this method wouldn’t provide it
“move the bullet after the part”: start at slide 2 of the image, same thing happens
“start the ray at the back of the projectile”: this is a partial fix i’ve implemented, but it’s still possible to trigger the issue, it’s just a bit harder
if you need any elaboration ask in the replies because ik this is probably confusing
Could you elaborate on a few things? First, clarification on your problem. Is your problem that the projectile collides with characters and does not register a collision? Or just “parts” in general? How often does this happen? Does it only happen in specific cases?
In clarification, I would have to ask from who’s perspective is this collision happening and not being registered, and who is the authority in your game for the physics on the projectile and for detecting collisions.
I would also ask your method for determining collisions in the first place and why you’ve selected this method. I’d also like to know your definition of a “raycast projectile” and the relationship between the projectile and raycasting.
this is a relatively uncommon issue as you need relatively precise timing but it happens enough to be a concern
when it happens, the projectile doesn’t at all register the part it clips through, as if it wasn’t there
the projectile is entirely handled on the server, the physical projectile model is only for visuals and the actual behavior is done via a script that handles raycasting and updating the model position
the collision method is a ray from where the projectile is now to where it’s going, selected this because i don’t trust roblox physics to have accurate hit detection, and the projectile is just a model that’s updated for the raycasting. the actual projectile is just a single ray instead of a whole bunch of them
i Am Using deltatime correctly it’s a problem with raycasts not registering parts if it starts inside them, it makes enough sense because there wouldn’t be a good way to return RaycastResults.Normal if you detected it as a hit, but i was hoping someone had this problem before and knew of a way around
You could try starting the ray further back and overlapping them, if that for some reason is not possible, you can calculate a direction vector when using a spatial query by doing something like:
local direction = (hitObj:GetClosestPointOnSurface(bullet.Position) - bullet.Position).Unit