PrismaticConstraint fails to move part fully sometimes

A developer knows what the developer needs best. If I want to disable physics sleeping on a specific part or set of parts from the default, there’s a good reason for it. I shouldn’t have to use workarounds for an engine feature that should be toggleable on a granular per-part basis to begin with because of some convoluted reason like “maybe you don’t understand how game engines work”…

2 Likes

True! I would love for there to be a feature to just disable the sleeping feature for these specific constraints, since these are the only constraints I have this issue with.

1 Like

Something interesting that was noticed: the constraints get stuck as already known, but upon exiting the vehicle seat of the train, the constraints move and the doors close! (Notice the close sound after I hop out)

Well, I just said that disabling and enabling the constraint didn’t actually fix it. I also tried continuously doing it every 0.3 second or so while the door was closing and it still didn’t help.

My guess is that your character touching the doors is waking them up and allowing them to close fully.

One way to debug what’s going on is to turn on sleep state visualization. In Studio Settings, select the “Are Awake Parts Highlighted” option to see what parts are awake and asleep. Awake parts will have a red border, and asleep parts will have no border or an orange border. It’s possible that you’ll need to set a larger Velocity for the prismatic to get it to close, since the doors may be going right back to sleep when they open.

We are looking into other ways to improve the sleep system that would likely help in this situation. For example, we could add a check of a servo’s CurrentPosition and TargetPosition to determine if the parts should sleep.

Thanks

2 Likes

My character isn’t touching the doors, all I did was hop out of the vehicle seat and it makes the doors close.

How can I set a larger velocity?

Oh, got it. Jumping in and out of VehicleSeat will wake the assembly that it’s welded to, so it makes sense that the doors would wake and finish closing.

You can change the velocity that the doors move by setting the Speed property of the PrismaticConstraint. You may also want to increase the LinearResponsiveness and the ServoMaxForce.

2 Likes

Was able to find a workaround that was perfect for what we were doing (setting the target position to be after the actual target, and then setting it to the actual target).

1 Like

Awesome! That seems like a good fix, setting the target to be a bit “larger” will tend to keep the velocity higher as the doors are nearly closed which should prevent them from sleeping.

I know it’s frustrating to have to work around the sleep system, the issues you ran into are one of the most common that developers have raised. I’ll be continuing to work on improving the sleep system in the coming year, and I plan to address these sorts of issues.

Thanks

2 Likes

Unfortunately, it still sleeps, but at the increased target position, which is weird since the previous behavior makes it stop just before, so you would think it would do the same for the increased target position and make it stop at the intended position instead.

Sorry, bad wording on my part. You’re absolutely right, they should still sleep. By setting the larger target position, they should have enough velocity when they’re passing through the original target position that they won’t sleep until after they have closed.