# Using Physics 2D to mimic a 3D effect

I haven’t really figured out how to approach this, but a question I had was if it is possible to leverage the Physics 2D enging someow in a 3D game - for example, lobbing a ball over a wall or shooting a laser “straight ahead” and seeif in anything is hit. Some sort of “2.5D” module for example.

In the concept of a ball, the physics engine is there only to “bounce” the ball back = we’re still resonsible for drawing in 3D, but getting the “physics” math done seems like it would be simple. Same with a bullet or laser - the “2D” plane would be based on the angle of the projectile, and we’d do the “physics” math based on the 2D plane through the 3D space. Problem I’m hving with that: getting the 2D plane from 3D space :)…I thought of maybe using something like a voxel and having a large “hit/miss” ratio and mapping that to a 2D space.

Does any of this make sense? Could it all be done as a maths library and we “leverage” that for simple 3D effects?

Well, depends on what you want to do. If you want e.g. a bouncing ball in a box, you could use the 2D physics for the bouncing and give it an own velocity variable to move inside the box. When you hit a wall, mirror the velocity vector. Of course, the bouncing wouldn’t be much to do on your own then too.

If you go to more complex scenes, say a room full of boxes where a ball should collide, you need a 3D physics engine. Otherwise you would have to calculate the collisions of the ball with all boxes and then decide what to do. Still not so hard if the boxes are static, but if the boxes have masses and will react on the ball it gets really hard to calculate.