Implement a conveyer belt into my game

Hello everyone,

for my game, I intended to add conveyor belts for some jump n’ run challenges.

I don’t know how to specifically code it yet. I want to have an attribute to change the force that is given to the player when he touches the conveyor belt. Also, I want it, so the conveyor belt wouldn’t have to care about the direction.

I’m grateful for any help

Hi @SayHiToMePls,

Just to verify so everybody understands, can you give an example of a conveyor belt?


do you know the ones you find inside an airport?

When you stand on them, you get transported forward. If you run in the same direction, you are very fast and very slow when you go the opposite direction.

1 Like

So, do you know how to make a conveyor belt?

I don’t have an example in mind, but one way is to use a kinematic rigid body, with high friction, that you animate (translate) its position.

What do you mean by that? I don’t quite understand

Check this manual page, kinematic objects are basically bodies that can take part in the physics sim but aren’t affected by gravity and other forces. That means you can move them around like regular entities:

// inside a script update method
entity.translate(0.1 * dt, 0, 0);

1 Like

Can I maybe work with applyForce? I want to take in account the direction the conveyor belt is facing, so the force is always applied in the direction of the CB.

Apply force will only work with dynamic bodies, that won’t help you move the belt.

But you could something else, instead of moving the actual belt body, use a trigger to detect when entities touch the belt and apply a constant force on them. It will have a similar effect I think.

This is exactly what I had in mind and this is what I cannot implement

Try posting a sample of what you managed to put in place until know, and from there ask if you can more targeted questions so we can take it step by step.

I haven’t managed to put anything. I can only tell you what I have in mind

So far, I only have a script to translate the texture

1 Like

If you go with second option, check this tutorial on how to setup triggers, to detect when entity enters the belt:

OK, now it can detect, if only the player touches the conveyer belt

Now I need to know how to apply the force in the correct direction, i.e. the direction the conveyor belt is facing foward to

You can use the entity.forward property as a base to calculate the direction of the force.

Check this tutorial and play with the example project, it uses exactly that to move forward or strafe: