Adjust character y position when sit ability is active

JMab

New member
Hi, I have implemented a Sit ability. Everything works fine, except when I use characters of different heights. For a small character, their bottom is below the seat by default.

I thought I could get around this by calcuating the offset from the ground to the hips for an average character that sits on the chair perfectly, and then calculating the offset from the hips for a small character. For example, an average character may have their hips position at 0.9, and a small character may have their hips position at 0.5, so the hips offset for the small character is 0.4. When the small character sits in the chair, I want to add 0.4 to the character's y position.

I tried setting the game object transform directly in the ability, but that seems to be ignored. I tried using m_CharacterLocomotion.SetPosition(), but that stops the ability working.

Is there a way I can introduce this y position offset when the ability is active?
 
There is no way to configure an offset, but you can position your player in the ability through code when you disable gravity. You can have a look at the drive ability, where the player is positioned in the car with a dedicated transform (DriverLocation). If you move the transform up and down in the scene view, the character is moved with it.
 
Top