Hi again Simon! Yes absolutely I can give code with context - the code I'm using as reference is from the end of day 50.
So, this is how the values in question are computed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 | // Vector containing WallX (in this example case)
// computed as the vector from the center of the test tile to the wall we're testing
real32 DiameterW = TileMap->TileSideInMeters + Entity->Width;
real32 DiameterH = TileMap->TileSideInMeters + Entity->Height;
v2 MaxCorner = 0.5f*v2{DiameterW, DiameterH};
// Vector containing RelX
// computed from the center of the test tile to the Entity's current position
tile_map_difference RelOldPlayerP = Subtract(TileMap, &Entity->P, &TestTileP);
v2 Rel = RelOldPlayerP.dXY;
// Vector containing PlayerDeltaX
// computed as the position delta from the entity's current position
v2 PlayerDelta = (0.5f*ddP*Square(dt) + Entity->dP*dt);
|
and the linear blend equation in the
TestWall function looks like this:
| real32 tResult = (WallX - RelX) / PlayerDeltaX;
|
Hopefully that makes it clearer what I'm trying to say -
MaxCorner and
Relare computed as quantities relative to the center of the test tile, but
PlayerDelta is computed as a quantity relative to the Player Entity's current position.
It was my understanding that all the vectors needed to agree on a common "origin", or the math wouldn't work. Am I misunderstanding something? Appreciate the help!
- Jonny
[EDIT]: Here's a little sketch with what I'm describing, in case that makes it any easier to understand. Thanks!