Introducing Shapecasts

Oh my flippin’ goodness. I’ve been staying away from these because I thought it was a Studio Beta. :sweat_smile: Now I can use them in peace, not wondering what would happen on the player side xD

@subcritical - I noticed that :Shapecast came out this week!

Sorry to be annoying but does the release also include margins?

What a glorious day.

Is a certain degree of inaccuracy/inconsistency to be expected when using Spherecast, as can be seen in the following video, or is this a bug?

Video (Streamable link)

To reproduce what’s seen in the video, just use Spherecast to cast a sphere, and move a part around, such that it intersects the cast (and place a part at the position of the RaycastResult so you can visualize the intersection).

2 Likes

It seems to be a bug with spherecast, or it’s something that is not documented.

If there’s a wall close to the spherecast it would literally not detect any hit at all, it doesnt depend on the distance to the wall it just seems to be really specific “dead spots” where it wont detect basically anything, the way I got these spots was by raycasting and reflecting a sphere multiple times

Here’s a video

Here’s a place with one spot I found, the script runs and prints the result (nil)
SpherecastBug.rbxl (86.8 KB)

if it’s not a bug then Im not really sure why this happens

3 Likes

Not sure if it will make a difference since luckily staff has already replied, but feel free to add that to this topic

1 Like

Could we also have Conecast for line of sight?

I noticed on the API documentation, that other than blockcast and spherecast, there is ‘Shapecast’

image

What does this entail and is it released / usable?

It’s been released and you can use it. Allows you to cast a shape represented by a support BasePart, which means you can cast CSG Unions, MeshParts, regular Parts, etc.

What difference does it have with sphere and blockcast? (I.e., performance, efficiency etc)

I assume generalized shapecasts would be slower perfomance wise, compared to sphere and block casts, and i think they both work in a similar way (shapecasts could be just a tiny bit more accurate) so just use block/sphere cast if you plan to use block/sphere mesh cuz the perfomance trade off is not worth it :grin:
could change in the future tho

i feel like they are never gonna add tolerance

well im pretty the performance differance is very small

maybe i should use block cast

Will :Cylindricalcast() be released?

1 Like

Just use a cylinder mesh and Shape casting, should work exactly the same

Just in case anyone else just wants to skip to the learning part.

1 Like

it would be cool if you add cylindercast
like

cframe : CFrame, 
diameter : number, 
height : number, 
direction : Vector3, 
params : RaycastParams
2 Likes

you know car randomly fails when you put part on it?
also i’m not expert at coding

Hey um there is a bug with shapecasts where if you pass an incorrect instance such as workspace:Shapecast(workspace.Model) it will crash your game.

5 minutes of work gone :frowning:

3 Likes

Is there an ETA on margins for shapecasting? It’s been a year and this is extremely important

6 Likes

if we have shapecasts now then why not save us the time of raycasting 10 times

1 Like