@Grey If he wants me on ignore, let him. As he is a large member of the community, I have a lot of respect for him, so I respect the fact that he doesn't want to hear me speak. I will do better to censor myself after this.
My Job is a thinking job (programmer) and I work in an open style of office.
I used to have a quiet area to work in and at one point, my own office.
We are moving our office to a new building and the plan is to make it even more open.
How can I convince management to move us into an office ...
Hooke's law is a principle of physics that states that the force F needed to extend or compress a spring by some distance X is proportional to that distance. That is,
:F = k X,
where k is a constant factor characteristic of the spring, its stiffness.
Hooke's equation in fact holds (to some extent) in many other situations where an elastic body is deformed, such as wind blowing on a tall building, a musician plucking a string of a violin, or the filling of a party balloon. An elastic body or material for which this equation can be assumed is said to be linear-elastic or Hookean.
Hoo...
What happens is that my ball ends up touching the pong paddle but my collision handling is too fast so the ball ends up bouncing forward and back against the paddle until it either gets out and glitches and goes off map
What happens is that my ball ends up touching the pong paddle but my collision handling is too fast so the ball ends up bouncing forward and back against the paddle until it either gets out or glitches and goes off map
you see, the problem is that the bounding boxes overlap. which means the ball is, by the time you detect that there's a collision, partially inside the wall
so, in reality, you can throw the ball against the wall, and the ball bounces off the wall (after compressing against the wall slightly). in games. you throw the ball at the wall, and we wait for the ball's bounding box to intersect the wall's bounding box (which means the ball is partially inside the wall) and then we decide to make it look like the ball bounced off the wall
so. you have the starting position of the ball BS. you have the end position of the ball BE. somewhere along the line described by BS and BE we have the point where the edge of the box, intersects with the edge of the wall.
so, lets say you take two balls. and you throw them so their paths will cross. but you throw one ball much faster than the other. if you sweep the areas of their motion, you would come to the conclusion that they actually hit each other. but where in time they cross determines that they actually didnt
so, what we're trying to do is find out when a collision occured. and then if a collision occured, and where it occured. then we can use that information to resolve the collision
it gets more fun when there's multiple things in motion
so, what you do is "broadphase" collision, which is typically very fast, but very innacruate. to throw out things that really wont collide
then, you sort your collisions by time
then, you do narrowphase detection which works out if things actually did hit
now. its possible that one object was marked in multiple collisions. and since we've altered the path of that object, we can remove it from any further collisions that happened later
(or we can resimulate, bu no one bothers to do that)
there's a thing called the separating axis test. and it does what we're talking about. finds the axis between two things and then works out where they intersect
but there's a really really cheap way to fake it
alright
imagine your balls bounding box
in your pong game "space"
if you were to flatten that 2d object into a 1d line. by projecting the box down to the X axis, and across the Y axis.
what im trying to tell you is the complicated and correct way of saying "move the ball backwards along its motion until it stops colliding with the wall, then change its velocity and simulate it for as much time as you moved it backwards"
which is why just changing the velocity doesnt work
which is what we're trying to do by finding the time of actual collision, we're skipping the iterative approach of just moving it backwards, and working out exactly where to place it
yes. and if you want to be correct you can simulate it for however much time you just rewound
one last thing. games work in discrete timesteps. 30fps is 1/30th of a second. so we have a snapshot at T0, and we have a snapshot at where we think T1/30th is. there's still 33ms between those snapshots.
so, within that discrete timestep, im moving my objects along a path over time. over that 33ms. and I can pretty much assume linearity unless there's insane acceleration. so. i can pretty much assume that the middle of the path my ball takes, is equal to half the elapsed duration of the discrete timestep