Introducing Shapecasts

Is there a way to visualize the casts?

Would a block cast perform better in performance vs a 4 corner raycast? Can it handle being fired just as many times as a regular raycast?

How do the shape casts choose between many instances for the result? As I have tested the sphere cast with 2 instances equally apart; however, it continuously chooses one instance over the other when casting.

This has already been explained as you can see here:

Compared to a few raycasts, perf depends on the size of the blockcast - Larger casts naturally have to consider more parts to potentially hit. Profiling is the best way to find which one is faster.

A blockcast is usually be more “correct” than just raycasting at four corners.

4 Likes

Should this be used over region3 detection?

1 Like

Different use cases. Region3s find all parts within a box; shapecasts find the next part in a direction.

Hey, you guys got any updates on margins?

RobloxStudioBeta_o6d7a
I think there’s a slight oversight in the error message. I did read the limit is 128 studs, but why does it mention the max radius is 512 studs instead?

Edit: The real radius limit is 256 studs apparently, but that still concludes that the limitations are documented wrong in the error and the post itself

2 Likes

I want this information for my use case. I don’t care if the part it gets is arbitrarily chosen. Will it ever be available?
There are multiple, trivial, workarounds to this, but if it were possible to just receive it’d make the code simpler.

1 Like

We raised the maximum size. Thanks for noticing; the post has been updated.

The maximum radius in the spherecast error message is wrong. We have a fix for that going out soon.

4 Likes

Semi-regular check on status of margins. Would love to get to use these soon!

6 Likes

Another weekly check on margins. ETA?

4 Likes

There seems to be a bug when using Workspace.Spherecast on mobile. Cast data is very noisy on mobile. Test it out here: Car Test - Roblox

On PC (MacBook Pro16 M1Pro):

On Mobile (iPad Pro 2019):

1 Like

Thanks, this is fixed in the next release. Nice handling on the suspension BTW.

We had a bug in low-level math code that was specific to mobile CPUs. We’ve made improvements to our automated test systems so this won’t happen again.

4 Likes

Margins are being worked on in parallel with partcasts. I won’t provide a firm ETA because exact timing is subject to change, but know that we consider these important :slight_smile:

6 Likes

Would it at least be more performant to use a shapecast instead of lots of raycasts though? I heard raycasts were pretty optimized compared to before but idk if shapecast are optimised at all

2 Likes

I’m having similar issues as @supersanjeet11 with shapecasts on mobile.
Here I’m using a cubecast that matches the CFrame of the HumanoidRootPart.

Computer:

Mobile: (iPhone 13 Pro)

As you can see, on mobile the shapecast seems to have many inaccuracies as the CFrame rotates which causes the character to bounce and vibrate.
When using a single raycast this effect does not occur.

I don’t want to have to resort to using multiple rays around the character as cubecasting is perfect for character systems like this.

2 Likes

The release that contains the fix for this was delayed due to some rollout issues.
This bug should be fixed this week.

3 Likes

Truly, and i mean TRULY, my favourite feature of roblox studio!

Finally, I dont have to go through the pain of :GetPartsInBoundingBox !