Offset a replaced mesh?

I’m trying to get a crouching system working,
Currently my player collision origin is at the center of the player.
When I replace the player collision mesh with a smaller Cube, the Cube appears at the center of the player (because of the player collision origin), whereas I want the Cube to appear at the bottom of the player (to act as feet collision while crouched).

Is there anyway to offset where objects are spawned (using python) ?
Changing the origin -> edit mode, ruins the collision bounds.

I’m using the instantReplaceMesh function:

crouch = cont.sensors['crouch']  #keypress


swap = cont.actuators['crouch']  #edit object


if crouch.positive:
    swap.instantReplaceMesh("Crouch_Collide", True, True)

Thanks

“Changing the origin -> edit mode, ruins the collision bounds.”
Can you move the Smaller Cube’s origin out of it’s center?

It normally works like that, or maybe I read what you wanted wrong.

Press space or left ctr to evade the obstacle:

Attachments

crouch.blend (513 KB)

Oh right, I forgot about that :p, thanks for the .blend example!