AlignPosition seat spazzes out

Hi! I’m currently having issues with a bug where a seat that’s following an NPC through an AlignPosition and AlignRotation spazzes out as soon as the player equips a tool. I’ve noticed that bigger part count within the tool = bigger impact. Sometimes it’s also possible for regular character physics to cause the NPC to fling entirely, which is not desirable behavior in my case.

  1. What do you want to achieve? Keep it simple and clear!
    In my game, I have a mechanic where players can sit on an NPC’s shoulders, kind of like this.
    image

In the past, I used a regular welded seat to the NPC to do this, but this led to issues such as players killing the NPC and other players due to weld behavior. As such, I’m trying to ‘weld’ the seat using an AlignPosition with RigidityEnabled instead. So far it works out okay, except for one major bug.

  1. What is the issue? Include screenshots / videos if possible!
    When sitting on the NPC and the player equips a tool with a large amount of parts in them, it causes the NPC to fling off into oblivion, as seen in the video. Do note that all the parts are massless, so they shouldn’t be having any physics impact. I’m not sure why this happens.

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Things I’ve tried;

  • Setting the Seat’s position in a .Stepped event (same issue as before)
  • Searching the DevForum
  • Pulling my hair out in frustration

I’m not sure where to proceed with this, so any assistance would be very helpful.

1 Like

Perhaps the issue resides in the player collision? It would explain the weird push/pull movements in the video you shared.

You can either make separate collision groups, separating collision between a Player group and an NPC group, or disable player collision altogether.

I’ve gone ahead and tried that, however this doesn’t appear to be the solution. Disabling collision between players and/or the NPC doesn’t seem to have an effect on the issue.

For debugging’s sake, can you lift the Y coordinate of the position you get moved to, just to see if the issue continues even after the player does not touch the NPC?

I have trouble with AlignPosition and seats as well. It applies weight to the assembly for some reason. @DrCherenkov is the one to speak to.


While I managed to fix the tools causing the flinging, I still have the problem of players themselves causing physics interference, and ideally I’d want to prevent that too.

During debugging, I found out that the reason for this might be the fact that the seat gets momentarily teleported under the player, which of course applies force because the AlignPosition wants to get back to it’s original position. Might be a bit hard to see in the video, but it’s there.

Final reply. Decided to just ditch the AlignPosition and it’s wacky physics and fix in the position every .Stepped on both the server and the client to prevent latency. We’ll see how this works out, but for now this is solved.

Did you try using a RigidConstraint? That should be equivalent to having a rigid AlignPosition and AlignOrientation but is treated differently internally so I’m curious how it would behave. Can you provide a reproduction file? I’d like to look into this a bit deeper. Thanks.

1 Like

Heyhey!

I’ve actually just tested out the RigidConstraint and it actually seems like the best option here without any caveats and it’s likely better for performance. I’ll go ahead and mark this as the solution.

2 Likes

Sorry to bother once more, but after giving it to the public to test, I have found out that I’m back at square one - the same bug i was trying to prevent somehow still exists. For some reason, the RigidConstraint is treated like a weld and when the player dies on the seat, it still kills the NPC.

I’m not sure what other solutions there could be to this issue, and I’m starting to run out of ideas. I was experiencing pretty bad latency with the .Stepped method, so I’m not completely sure what to do here.

Can you DM a reproduction file? Based on looking at the code, we didn’t expect the death behavior from RigidConstraint so I’d like to take a closer look. I’d also like to see why AlignPosition isn’t working. Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.