While debugging worldtest some more, I came across the following: Breakpoint 1, world::moving::update_position (this=0x371ce0) at ../../../adonthell/src/world/moving.cc:247 247 vector3<float> finalPosition = execute_move (&collisionData); (gdb) print eRadius $1 = { X = 20, Y = 12.5, Z = 40 } Current language: auto; currently c++ (gdb) print eSpacePosition $2 = { X = 9, Y = 12.8000002, Z = 1.125 }
Instead of of being 12.8, eSpacePosition end up being 12.8 and a wee bit more. While this doesn't seem like a big thing, it could corrupt the character location in the long run. Another thing, after adding some more debugging output to see character location, the tiles being checked for collision and the point where collisions occur, the following was the result: // first iteration: no collision as character is not moving pos [185.000, 200.000, 40.000] area [165, 188, 0] - [205, 213, 80] shape [120, 140, -5] - [180, 200, 0] shape [180, 140, -5] - [240, 200, 0] shape [120, 200, -5] - [180, 260, 0] shape [180, 200, -5] - [240, 260, 0] // second iteration: gravity pos [185.000, 200.000, 40.000] <-- center of the character sprite area [165, 188, 0] - [205, 213, 80] <-- area checked for collision shape [120, 140, -5] - [180, 200, 0] <-- 1st tile col [180.000, 200.000, 0.000] dist 0.03175 col [180.000, 200.000, 0.000] dist 0.03175 shape [180, 140, -5] - [240, 200, 0] <-- 2nd tile shape [120, 200, -5] - [180, 260, 0] <-- 3rd tile shape [180, 200, -5] - [240, 260, 0] <-- 4th tile col [181.404, 201.404, 0.000] dist 0.02273 col [181.404, 201.404, 0.000] dist 0.02273 col [184.167, 200.000, -0.347] dist 0.00955 <-- closest collision on 4th tile What I had expected would be a collision at [185, 200, 0] with distance 0 as that is the point the character rests on. It would be interesting to see the same figures for the working alpha-2 code for comparison, so here they are: pos [25.000, 0.500, 40.000] area [165, 188, 0] - [245, 253, 80] shape [180, 140, -5] - [240, 200, 0] shape [120, 140, -5] - [180, 200, 0] shape [180, 200, -5] - [240, 260, 0] shape [120, 200, -5] - [180, 260, 0] shape [180, 140, -5] - [240, 200, 0] shape [180, 200, -5] - [240, 260, 0] pos [25.000, 0.500, 40.000] area [165, 188, 0] - [245, 253, 80] shape [180, 140, -5] - [240, 200, 0] col [25.000, 0.000, 0.000] dist 0.00080 col [25.000, 0.000, 0.000] dist 0.00080 shape [120, 140, -5] - [180, 200, 0] shape [180, 200, -5] - [240, 260, 0] col [25.000, 0.500, 0.000] dist -0.00000 <-- center of character resting on ground shape [120, 200, -5] - [180, 260, 0] shape [180, 140, -5] - [240, 200, 0] shape [180, 200, -5] - [240, 260, 0] While they are not completely comparable (relative vs. absolute values), you'll see at least the the collision(s) occur where they are expected. Directly at the center of the character with a distance of 0. Makes one wonder if it is just a precision issue after all. I'll keep on debugging. Kai P.S.: Attached is a patch to get the output above with the current CVS code, in case that helps.
debug_output.patch
Description: Binary data
_______________________________________________ Adonthell-devel mailing list Adonthell-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/adonthell-devel