13
votes
Accepted
How hard to brake to perfectly smoothly reach the destination?
When an object brakes with a constant deceleration, then its velocity over time looks like this:
Distance traveled is velocity multiplied with time. So the orange area in the graph above actually ...
3
votes
How hard to brake to perfectly smoothly reach the destination?
The simpler approach, but still somewhat smooth
By approximation, we could create such a braking curve and this would work for a kind of "smooth" braking:
$$
f(t) =
\begin{cases}
2t-2, &...
3
votes
How hard to brake to perfectly smoothly reach the destination?
This is a methodology I adopted when designing an automated model train system where the train had to stop at a signal. The physics is much the same as Philipp explains, although I took a slightly ...
2
votes
Get closest point on box to line
I wasn't happy with any of the answers here, as I wanted an answer for the 3D case, so I went ahead and wrote a shadertoy which demonstrates how to query the closest point between a line and a box.
...
1
vote
Mirroring a Character's Position In a Shadow After Rotating 180 Degrees
Cache the shadow's authored horizontal offset from the sprite either at edit time or on spawn:
...
1
vote
How to rotate spaceship quaternion to face target direction with constant angular speed?
I got it. I was nearly there for ages, and flipping the multiplication on the final statement (rotationToApply * orientation, not orientation * rotationToApply) fixed it. Apparently whether you are ...
1
vote
Max velocity for smooth deceleration to destination
Just work backwards to set up a "glide path" are the closest points/maximum speeds you can get without overshooting:
If you arrive to the destination at max 2f/s velocity and then change it ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
mathematics × 1989unity × 238
physics × 211
vector × 199
3d × 178
c# × 165
2d × 149
rotation × 145
opengl × 134
matrix × 133
algorithm × 129
geometry × 129
c++ × 119
collision-detection × 94
java × 86
linear-algebra × 79
javascript × 74
camera × 70
quaternion × 69
game-design × 67
transformation × 64
xna × 60
movement × 58
trigonometry × 55
graphics × 50