I am having some difficulties with getting one Entity to push another.
Even with the bounciness set to 0, the pushing object tends to send the stationary object flying with quite a large amount of velocity. My pusher is a Box prefab being moved by an EntityMover.
Having one object push another
Re: Having one object push another
Launching effects are generally created by brief high accelerations and associated short-lived velocities. If the entity mover's goal spans a small length, but in a much smaller time, the velocity changes will be quite large and will 'kick' objects in the way.
These kind of jerky goal states can happen quite easily if the goals are created from a variable framerate update instead of the internal update rate. For example, if the pusher is kinematic and the Space time steps multiple times in one frame, but the goal is changed once per frame rather than per Space time step, then the kinematic will experience a large corrective velocity for the first time step, reach its goal, then return to zero velocity for the remaining time steps. While the apparent motion per frame is correct, the velocities are discontinuous.
If the pusher's velocity is actually constant and consistent but brief, it can still cause an apparent kick. This is correct behavior, but can be a bit surprising sometimes. An example of this is the character controller. If you hit and keep walking into a block, the block doesn't bounce off the character. However, if you hit the block and stop thereafter, the block will keep moving because its friction is far less than the stopping power of the character controller.
These kind of jerky goal states can happen quite easily if the goals are created from a variable framerate update instead of the internal update rate. For example, if the pusher is kinematic and the Space time steps multiple times in one frame, but the goal is changed once per frame rather than per Space time step, then the kinematic will experience a large corrective velocity for the first time step, reach its goal, then return to zero velocity for the remaining time steps. While the apparent motion per frame is correct, the velocities are discontinuous.
If the pusher's velocity is actually constant and consistent but brief, it can still cause an apparent kick. This is correct behavior, but can be a bit surprising sometimes. An example of this is the character controller. If you hit and keep walking into a block, the block doesn't bounce off the character. However, if you hit the block and stop thereafter, the block will keep moving because its friction is far less than the stopping power of the character controller.
-
- Posts: 30
- Joined: Mon Apr 25, 2011 6:07 pm
Re: Having one object push another
Is there an event I can subscribe to, so I can properly update the goal with each timestep? Or should I update my Space one timestep at a time manually?
Re: Having one object push another
Yup, a variety. Every update space stage has its own start/end events. Since the EntityMover updates during the DuringForcesUpdateables stage, latching on to the Space.DuringForcesUpdateables.Starting event would work.Is there an event I can subscribe to, so I can properly update the goal with each timestep?
-
- Posts: 30
- Joined: Mon Apr 25, 2011 6:07 pm
Re: Having one object push another
Since my pushers are moving over time, I created a timer that I am incrementing by TimeStepDuration each time I get the DuringForcesUpdateables.Starting event.
The pushers work wonderfully now, thanks!!!
The pushers work wonderfully now, thanks!!!