How to move the character controller and the moving platform it is standing on.

I want to have a fake infinite level, I do this by offsetting everything (but the environment) when the player goes out of bounds (so that the level repeats endlessly).

I’m using the latest character controller (with “Moving Platform” enabled) for the player.

So far it all works, unless the player is standing on a moving platform when goeing out of bounds.
Then the player moves to distant positions,
I guess this is because the platform was just offsetted, and the character motor adds this offset as a velocity.

I’ve been looking add the code of the character motor for a while now and I just can’t figure it out, I’ve tried everything, but it just never works.
(basicly I tried to offset every variable it has that represents a position of some sort)

My latest attempt was to just make the player not grounded, by using the character motor function SetVelocity and setting it to it’s velocity+framevelocity

function SetVelocity (velocity : Vector3) {
	grounded = false;
	movement.velocity = velocity;
	movement.frameVelocity = Vector3.zero;
	SendMessage("OnExternalVelocity");
}

I have no idea what the sendmessage does,
but this kinda works, except the player can’t seem to get grounded on the platform again, untile it stops colliding and collides again afterwards.

So, any help?

Basically I just want to offset the player and it’s platform without the character controller or motor ‘noticing’.

I would do such a level by creating a collider/trigger that follows the player off screen, and when a platform hits the trigger it will be moved in front of the player (also off screen, but in the other direction ;))…this way the platforms the player interacts with don’t move…

A side effect is, that the infinite level is continuous, though, so the player won’t reach boundaries. That might not be the effect you are after…