I’m trying to create a kind of 2D box in which images fall on top of each other with collision detection. Like Tetris but with pictures and gravity. Being 2D I want the images to always appear flat, parallel to the screen.
For the collision detection I’m using ODE boxes. But being 3D boxes, when they collide, they rotate in all 3 axis. And this will not do because I need the pictures to be flat. I tried to ignore X and Y rotations and just use Z but, since ODE is actually using the three then the result is quite awkward and not realistic at all.
Another idea was to add a front and a back wall besides the floor, left and right walls. These extra invisible walls which would restrict the objects. Didn’t work. If I use spheres this works fine since they are round, But when I switch to boxes they get stuck in between the walls.
So, what I want is really simple. I want ODE to work in 2D instead of 3D. This way the (2D) boxes would always be perpendicular to the screen and everything would work fine.
I am also in the process off making my own ODE like stuff.
A new way off thinking using Polar/Cartesian for the ball, every ‘hit point’ forms the ‘new’ centre off the Cartesian node.
I wanted to make a 3 player pong for my multi-touch, still having hard time with the angle in = angle out stuff (ANY IDEAS??)
Any way, I have a formula that detects the hits with lines, if you have moving lines it works the same.
I will attach my proof off concept for the hit detection. Fiddle with the diameter stuff and forget the GDI stuff.
Actually, I ended up solving the problem in the happiest possible way. I took advantage of it. Instead of trying to make the system become 2D I found a nice way to make my result become 3D.
Reducing the cube depth until I got a very thin 3D “square” which now simulates materialized photographies. Well, it’s hard to explain.