- Home /
Offsetting player position from a moving Rigidbody.
Hi all.
I'm doing a small mockup of a runner style game as a proof of concept. I'm using a custom controller that utilizes a Rigidbody, and at the moment the character only needs to run forward and side to side, so that's what it does. So I have it running, I have a camera smoothly following it, but I'd like to offset it by a certain amount on the z-axis, controlled by the player, so that there's a bit of give in the character's position for the player to move forward and backward, allowing them to time when they go past obstacles and the like. I thought of having a main collider that handles all the normal movement and only collides with guiding geometry, then having an empty GameObject holding the character and related bits that I could offset, letting the character have it's own collider that could react to obstacles. This approach obviously wouldn't work, since the timing between the character and it's parent would be off in regards to things like slopes, curved walls, etc.
I haven't really had much cause to think about this issue until now, so I'm slightly mystified as to how to go about it. Does anyone have any ideas as to the general direction I should be headed to make this work?
Thanks for any help and advice.