Broken collision model with TweenService and Motor6D with Part detected with Raycast

A TweenService tween is used to tween a Motor6D’s C0 property to move the part up and down.
A :Raycast() is made between the RayOrigin part to the RayEnd part. When the ray hits, the part is blue, if it doesn’t hit, it is black.

Problem:
When the target part is tweened to the top, the ray doesn’t hit despite visually appears to be in line with the ray.
This appears to be a visual disconnect between part and collision box.

Other times I’ve experience a similar issue: A door model tweening a Motor6D hinge part to open and close doors, when doors are closed, it is visually closed, but the part has no collision despite CanCollide=true.

Reproduce file:
tweenServiceRaycastCollisionBug.rbxl (55.4 KB)

2 Likes

Hi, thanks for posting!

The behavior you’re observing is the current intended behavior when C0/C1 are updated. We intentionally don’t update any of our internal collision data structures. This produces a “fast path” for animations that improves performance, with the side effect that animations don’t always produce physically correct simulation.

Our recommended workaround would be to use physics constraints to move the parts. For example, adding a HingeConstraint to the door hinge, and using a servo or motor to move the door to the desired position. Basically, use physics constraints when you desire physically correct simulation.

2 Likes

When I was searching for bug reports right now about Motor6D and Collision. I think Motor6D were designed for Animations and have C0 and C1 like Welds do. And using Motor6D for anything else outside of Animations is not in the scope of Motor6D’s design?

 

So, I discovered that when I manually change the C0/C1 Orientation of a Joint, that it won’t have collisions for a certain amount of seconds… so is this related?

But not for Weld, unsure about the Raycast issue from here.

Physics Constraints are nice. But does Roblox offer a way to check if someone is “blocking” the constraint. e.g. a Platform that moves up and down. If someone stands under the platform to block it for instance. Is there a way to detect that, just like how the Source Engine can.

These forces and etc. are sort of complex. What I know is that if I have a rotating propeller made through Physics Constraint. That an Anchored Obstacle will stop it from rotating, no matter what…

When I was searching for bug reports right now about Motor6D and Collision. I think Motor6D were designed for Animations and have C0 and C1 like Welds do. And using Motor6D for anything else outside of Animations is not in the scope of Motor6D’s design?

Exactly, we recommend only using Motor6Ds for animations where you don’t care if the animated parts correctly collide with other parts.

If you do care about accurate collisions, you can use the new AnimationConstraint, more details here.

does Roblox offer a way to check if someone is “blocking” the constraint. e.g. a Platform that moves up and down. If someone stands under the platform to block it for instance. Is there a way to detect that, just like how the Source Engine can.

You can check if a player is under a platform by performing a raycast downward from the platform and checking if it hits a player. How is this done in the Source Engine, out of curiosity?

I have a rotating propeller made through Physics Constraint. That an Anchored Obstacle will stop it from rotating, no matter what…

Yup, that’s exactly right. The anchored obstacle won’t move, no matter how large the forces acting on it are.

I think would have to be a Blockcast at that point. But this would be different if one would say “how to check if a platform is being blocked”. No direction specified.

 

I didn’t study the details, but I checked.

The VPhysicsUpdatePusher function and FindPhysicsBlocker.

The Source Engine Physics aren’t really dynamic, there’s a class for physics that strictly can do a specific amount of things only, e.g. move up and down. On Roblox there are constraints but some of them are unpredictable. At the end it’s just math :person_shrugging:

 

FindPhysicsBlocker creates a CreateFrictionSnapshot. Not entirely sure what it does but “manifolds” are referenced, if I am looking at the right thing.

It seems to use that Friction Snapshot to determine the blocking object.

This entire Friction thing already seems to be aware about the available objects. There’s the object itself and another object, because apparently Friction is about two things by its definition? e.g. you let a box slide on ice? Not sure what this would be if it’s on ice and metal at the same time.

It knows the other object through those manifolds.

 

Now, based on how this sounds like, it just assumes that if it can’t reach its location, it assumes it is being blocked and holds the other involved object as responsible?

But it determines it based on the information from the physics engine alone, and that can not be extracted out with Luau.

I think would have to be a Blockcast at that point.

For a rectangular platform, blockcast would definitely be the way to go.

The VPhysicsUpdatePusher function and FindPhysicsBlocker .

Are these publicly callable APIs in Source? If there’s a documented, publicly callable API for determining if a part is blocked by another in the Source Engine, that would help frame the discussion for adding such a feature to Roblox.

I recall some performance issues about Raycast but, :person_shrugging:
regarding those “filters” that can be applied to it

 

 

The only thing I know about is the link that I linked source-sdk-2013/sp/src/game/server/baseentity.cpp at master · ValveSoftware/source-sdk-2013 · GitHub

In Source the Engine used to be VPhysics, and in Source 2 it’s Rubikon. No clue from where thus VPhysics APIs are from, I only know they are around some random GitHub repositories.

Then there’s mention about Havok. Havok - Valve Developer Community

 

Valve most likely has more in-depth documentations, but I am not sure how two communicate. I only know that it’s not impossible to receive a license somehow. Apparently, one has been given out for Portal 2 once.

I’m confused.

If someone stands under the platform to block it for instance. Is there a way to detect that, just like how the Source Engine can.

How do you know this is possible in the Source Engine? Is this speculation, or do you have specific knowledge that this can be done in the Source Engine?

Thanks

1 Like

I believe what they are referring to is the “Blocking Damage” certain entities can be assigned by Level Designers:

Blocking Damage (dmg)

Amount of damage done to entities that block the movement of this door, per frame.

(func_door)

I’m not entirely sure how it works, but the Source Engine seems to have a concept of “crushing”, which can cause physics objects to break into a set of pieces if some threshold is exceeded, and Blocking Damage would be an extension of that for objects that can’t be crushed like other physics objects, such as the Player and NPCs.

I don’t think this would work in Roblox as an engine-level feature, but maybe we could get some way of figuring out how much compressive force an object is under? Or just some way of knowing how much force got applied to it from an object, like through a new event that’s like .Touched but gives more information about the collision itself instead of just the parts that interacted. This could also be useful for creating impact sounds, instead of having to guess by tracking the velocity of the object.

1 Like

Because there’s this

If you block the pathway of a func_door or func_movelinear or even more, like func_rotating you’ll get damage.

I think it’s possible, someone seemed to have “injected” VPhysics into bullet physics, or maybe it’s the same thing, idk.

After all you can have a rotating part in Roblox’s Physics Engine and if it hits something it does get blocked, so it might as well be possible to figure out what it was blocked by.

After all you can have a rotating part in Roblox’s Physics Engine and if it hits something it does get blocked, so it might as well be possible to figure out what it was blocked by.

One option would be to use a touch event to determine what the door is touching, i.e. what is blocking the door.

1 Like

The thing is the Touch Events are also having issues, but those bugs are reported already.

Plus, if you have a character stand on a rotating platform you will have issues figuring out what is blocking it, because there’d be a Part always touching it.

Yeah, I agree. It’s hard to rely on Touch Events for keeping track of part contact.

Unlike other game engines where you have 3 other signals to rely on such as:

  • TouchBegin
  • TouchStepped
  • TouchEnd

I’ve been using other methods to achieve that and they are not ideal nor performant.

If we get better touch events. TouchStepped for example would be a good use for your problem where every physics step would give you the part that’s touching the player and perform calculations on the part forces.