I’ve decided to use PGS constraints, HingeConstraint and PrismaticConstraint to create swinging and side-moving doors respectively.
The constrained parts are in their individual CollisionGroup and only collide with Players and NPCs.
The constraints use the Servo ActuatorType with infinite force and variable levels of speed.
When the door is to be moved, the TargetAngle or TargetPosition of these constraints is set to the appropriate value.
My question is, why do the constrained parts get “stuck” sometimes, only moving after a player attempts to walk against them? What can I do to prevent this behaviour? Is there an efficient way to detect this is happening?
The server is the network owner of all parts, so the player shouldn’t influence them in any way.
This is due to the fact that if the Player is the network owner, they may change the values of the constraint and it will replicate to the server. The player having network ownership would allow for it to open and close doors at will for all the players in the server.
Which is not desirable often. Setting ownership to a particular client assures a smooth experience for said client. It merely hands the physics calculations to them, if the client were to set any other properties for the part it does not replicate as far as I am aware.
You are not wrong, but avoiding that by never allowing a client to take ownership is not a very viable solution. I reckon a smooth player experience outweighs a bad apple using it to their advantage, which can be countered in other ways. (server-sided checks for probability of an action being possible, to name one)