Page 1 of 1
conveyors?
Posted: Mon Sep 17, 2012 8:58 pm
by fredlllll
how would i do conveyors?
yeah pretty short question ^__^
Re: conveyors?
Posted: Mon Sep 17, 2012 9:17 pm
by Norbo
The core idea of a conveyor belt or similar thing is that it applies force, but not beyond a maximum speed. Objects on a conveyor belt do not keep accelerating on into infinity.
So, a simple model of a conveyor belt could be a force which is clamped to prevent accelerating an object beyond the maximum speed.
For a simple conveyor 'volume,' you can figure out an object's current speed relative to the conveyor by dotting the entity.LinearVelocity with the conveyor direction. The difference between the conveyor speed and the current object speed tells you that maximum instantaneous acceleration you can apply.
Clamp the goal acceleration by the maximum acceleration to compute the acceleration to apply. You can then just add that acceleration to the LinearVelocity. You can also do something equivalent with forces.
A more physical conveyor belt could be created with a few moving (probably kinematic) entities. As each entity moves past the belt's end, teleport it back to the start of the conveyor. The velocity of the entity will make any other dynamic entities which fall upon the conveyor move. Be careful about the ends of the conveyor; make sure the conveyor pieces can teleport out of and into place safely- don't let a player stand where they're going to appear

Re: conveyors?
Posted: Tue Sep 18, 2012 12:34 pm
by fredlllll
and what if i want to run on the conveyor? then the player is going his maximum speed + the conveyors speed. or at least he should
Re: conveyors?
Posted: Tue Sep 18, 2012 3:22 pm
by Norbo
If you want all interactions to be consistent without doing much work, then the best option would be the entity-based conveyor. So long as you move the conveyors along the path using velocities (an EntityMover/Rotator could simplify this for you), a character running on top of the conveyor will respond appropriately. Getting that behavior to work with the other, more approximate volume would be annoying.