Wow! This is going to work just fine. I love it!
Amazing, A needed update, Gonna make combat in most games wayyy easier.
This is literally already possible
I had no idea that this implementation of shapecasts was possible. I wonder how easy it is to implement with something like this though.
I am not talking about conecasts. I was talking able being able to detect parts in a cone shape.
It seems as if I had mistakenly replied to the wrong person my bad.
Anyways the code is pretty simple
local function IsPartInCone(conePeak: Vector3, coneDirection: Vector3, point: Vector3) -- Cone CFrame from peak looking into cone
local CONE_RADIUS = 32
local CONE_HEIGHT = 64
local Angle = math.atan2(CONE_RADIUS,CONE_HEIGHT)
local ConeDirection = coneDirection.Unit
local PointDirection = (point - conePeak).Unit
return Angle < PointDirection:Dot(ConeDirection)
end
This literally took like 5 minutes to write.
I have a very game-breaking issue with shape casts, they crash the game! On both studio and game client (I can’t pinpoint a way to replicate it) but once the heartbeat loop is activated that creates a shape cast around a bounding box of a model in the direction of the velocity’s unit, the game crashes, and Roblox gives the error message something along the lines of ‘oops sorry we have to quit… etc’, No errors in the output, it just crashes, I can’t seem to “replicate” this issue easily so if someone familiar with shape casts wants to take a look I can add you to the team create.
Note I’m 100% sure its because of shape casts.
code as example:
function Update_Hit_Scan()
local Folder = Detection_Data.DetectionFolder
local boundingbox, Size = Current_Hit_Model:GetBoundingBox()
local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Whitelist
Params.FilterDescendantsInstances = Folder
local Cast = workspace:Blockcast(boundingbox, Size, Vector3.new(1,0,0), Params)
if Cast then
print("hello")
Runs every heartbeat
Just curious, but why continuous collision? lol That sounds like the .Touched
event, which is notorious for being unreliable. For a second I thought they finaly gave us an improved .Touched event is there any plan for it? Or is using RunService while casting rays\shapecasts still the only way to go?
Still, amazing update! <3
Are you sure the unit velocity of the part is not NaN
? Also why are you creating new params each heartbeat?
good question lol, even if it was NaN, it shouldn’t crash roblox.
I’ve always had issue using ray cast effectively , because i mainly making fighting games. and it doesn’t do very well for detection for aoe’s or just hitboxes that arent a straight-line. so i use it sparingly. and i’m not to sure about the workarounds people have made to make raycast more practical. but this shape cast is what i’ve needed and wanted for years on this platform. region3 fell short for what this can do.
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.
Might I recommend the recently added WireframeHandleAdornment?
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.
So this only returns a single instsnce when the shape intersects with multiple objects?
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.
OK that clears things up for me and now i know what im able to use this for. Thank you.
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.
accidental reply whoops
There’s no way I can use Blockcasting without having to resort to making extra raycasts due to the lack of margin space.
Please, Roblos. marjin