Character SetActorLocation issues after standing on moving vehicle

BigDub
Thu, 08 Jun 2017 23:09:38 +0000
World Creation

I have a large ship and a first person character. The character is able to pilot the ship, i.e. character collision is turned off, hidden, and attached to a component of the ship while the controller possesses ship. When the character stops piloting the ship collision is turned back on, it is unhidden, detatched, and I use SetActorLocation to place the character precisely at the steering wheel of the ship.

The problem is that any movement the ship makes seems to doubly affect the character.
To pilot the ship you need to be standing in a overlap box near the steering wheel, which usually means you are standing on the ship. If the character is not standing on the ship when initially piloting there is no problem (e.g. jumping in the air and starting it while still airborne). If you were standing on the ship when you started piloting every movement the ship makes seems to be repeated on the character after the actor location is set.

For example if I drive the ship 10m forward the character appears 10m in front of the ship, or 20m ahead of where they started. If I turn the ship 90 degrees the character appears a further 90 degrees.

I checked the location that was being passed to the SetActorLocation and it is correct, so my guess is that something on the character movement component, or maybe the physics, is correcting its position after the SetActorLocation.

Can someone explain what is happening here? How do I put my character where I want it and keep it there, and why is it moving away in the first place?

Also, is this a good method for having the character pilot the ship? Are there better methods? Should I just destroy the character and create a new one every time? That seems like it could be tedious if the character carries a lot of information.

2 posts - 1 participant