It would be extremely helpful to be able to visualise raycasts just like in Unreal Engine. Whether this is by a RaycastParam or a checkable setting in studio settings (like geometrydecomp).
I do this currently by creating parts to visualise them, but it’s time consuming and doesn’t show intersection points unless you also program those in to test.
It still requires me to write more code to debug my raycasting to make sure I have set up the maths right and see if it should be hitting objects, when I say visualise I mean purely for debug purposes, so only visible in studio and for it to be convenient and quick to activate!
Yeah, not a substitute for some kind of built in visualization. Just saw an opportunity to spread the word about WireframeHandleAdornment since it’s a relatively new and quite powerful addition for any kind of custom debug visualization.
The shapecast will never intersect multiple objects, since it only proceeds up to the point of the first touch.
It may exactly touch multiple objects, and in that case you’ll get a seemingly random one of those objects depending on how they happen to have been ordered in the engine’s internal data structures.
I’ve tried using WireframeHandleAdornment but I am not getting any results. There is no information on the documentation page so I am wondering how you set them up.
Edit: Just figured out that they are not currently accessible to the public.
Are shapecasts intended to be deterministic? I seem to be getting inconsistent normals for the same inputs.
Using the same position, radius, direction and params casting into an anchored part. The two shapecasts returning different normals are across the server / client boundary if that changes anything.
bro… just check distance and then use something like this for the cone check.
function isFacing(cf, pos, angle) -- checks if pos is within the cone/angle of cf's facing direction
return math.acos(cf.lookVector:Dot((cf.p + pos).unit)) < angle or 120
end
i can’t think of a reason to ever shapecast a cone, this is certainly not one of its usage cases
That doesn’t account for precise collisions or even bounding boxes.
Conecasts would be perfect for precise collision checking which is one of the main purposes for ray and shape casts.
Use cases for Cone casts could be for certain ranged projectiles, shotguns / blunderbusses, directional shockwaves, or directional cast ability seen in topdown MOBAs.
They would be especially useful if casts could return a list of intersected instances.
I’m super excited for this, I really wanted to use something like this for the longest time so I could implement a fully custom character controller / collider with custom physics.
I hope there’s support in the future for (at the least) cylinders, and I really would love to see a CapsuleCast in the future since I think a lot of people will use something like this for capsule collider collision detection (two spheres jointly connected by a cylinder / aka pill shaped).
Rejoicing in the fact that I may not have to learn and implement some very involved mathematics for calculating collision.
Props to those like AxisAngles who have managed to do stuff like this using pure math in lua - I hope this is much faster if it’s inbuilt if its made using C?
I really think Capsule shape would be the most desired, especially for custom character controllers. Similar to a sphere cast but with an additional parameter a alongside the radius:
(with a cframe to specify orientation alongside position)
@preacher_online If you were to cast a capsule shape forward it would not produce a pill shape cast, it would appear like a parallelogram with rounded corners in 3d.
Thats gotta be the most epic update this year i was struggling with custom shapecasting for waaay too long but this update just fixed every single problem i had. Thank you so much