Introducing Shapecasts

This is amazing and very useful update, i can now do even more performant hitboxes :smiley:

6 Likes

Cool, even features points! Which I can reduce inertia, and remove unnecessary pushing from single cell character (bean hitbox), to move in environment, with better performance, including 200 cells (bean hitbox).

8 Likes

Looked at this feature because I found the API listing before it got announced, I was almost scared there was no way to find what position the shape ended at! super happy it got explained though. Awesome work engineers, thank you everyone who worked on this.

8 Likes

This is INSANE, probably one of the best features you guys added this year, it will help me and other devs a LOT with stuff like hitboxes, thank you all so much for doing this!

10 Likes

That is a really nice addition !
Could there also be a method for cylinders in the future ? This could really help me for a feature for which I am using a classic line raycast, which causes some inconveniences.

11 Likes

Although I would like to see pill casting in the future, this feature is incredibly important for my experience which relies on raycasting to create melee hitboxes (we’ve also released our implementation as a resource without the internal adjustments to fit our experience specifically). Big thank you to the sim core team for always delivering.

Some information from my previous post about shapecasting and why it’s big for me:

16 Likes

Omg I’ve been waiting so long for these.
FINALLY I can make a raycast-based physics library!

Physics objects that bounce and ricochet around using various shapes and rays.
This will be sooo cool and useful for that!

4 Likes

Now this is some quite useful raycasting, I sometimes use raycasting for getting distance between the player and the mouse target’s position, etc.

That’s like half the maximum part size, My game will be over 25K square studs, and Mesh Instances (not MeshParts) can go infinity and beyond

That’s like 16x smaller than the maximum part size, though Raycasts are invisible which isn’t a issue for me :wink: though is the Radius argument the size of the shape size?

Though I’m intrested to see PartCasts, I’m willing to use parts to raycast without having to get it’s CFrame, It should be like this

WorldRoot:PartCast(
   part: BasePart,
   direction: Vector3,
   params: RaycastParams?
): RaycastResult?
4 Likes

This is really useful! Thank you Roblox. Raycast is good but I love bigger shaped hitboxes so it’s easier for the player to hit someone, very happy it gives the .Position argument which OverlapParams doesn’t. Can’t wait for the maragin bug to be fixed, I will probably switch to this as my preferred hitbox system.

4 Likes

This is amazing! I might find it useful for a lot of my projects. Thanks Physics Team!

4 Likes

Love this and can’t wait to use it!

Just one thing, in the Code Samples of the Blockcast & Spherecast documentation there seems to be an error where Direction was used instead of Distance. Not sure if it will be changed to Direction but I just thought I’d point it out.

print("Distance until hit was found:", result.Direction) -- should be result.Distance
4 Likes

Out of curiosity, what use case would you have for pill cast?

4 Likes

Will this allow us to get the intersection point of a touch between two parts? I feel like with this, that would be somewhat possible. But what if an entire surface is in paralell with another? Where would the intersection be?

4 Likes

Partcasts are planned. :slightly_smiling_face:

21 Likes

Thanks, we’ll get this example fixed.

3 Likes

We’re thinking about batched shapecast or partcast APIs. They might work by passing an array of parts, so you could build your own model cast.
Do you have any use cases in mind?

13 Likes

thanks, but will it be like what I expected?

raycasting from the part without the CFrame nor Vector3 and only a few arguments

4 Likes

Finally.
This was REALLY needed! Good job.

4 Likes

@subcritical, Will there be any way of visualizing the raycasting like the videos shown?

10 Likes

Perhaps you could use model casting in a case like this:

The player has a special ability to throw a large boomerang, which can be dodged because of it’s hitbox. When the boomerang is thrown, it casts a Model Cast of itself from it’s current position to the new position and updates it’s position to the new position every Heartbeat.

Enemies may be able to dodge it by jumping over, or possibly stay in the middle of the boomerang if they have enough speed and timing to do so, and this is because the model of the boomerang’s design.

Using a model cast here would be efficient, since it’s using an accurate resemblance of the boomerang as it’s hitbox.

Not sure if this is already a thing, but if there is a way to also define the end orientation of the shape casts, the boomerang would be on board with using it.

3 Likes