4
\$\begingroup\$

I'd like to create a game with a half top-down (2d RPG) view (I don't know the exact name of it). It would be 2d, but I'd like to add 3d-like collisions. For example: enter image description here

If the grenade lands on the roof, it would roll down and fall. Or if it hits a wall, it would bounce back.

I've never worked with this view, that's why I'm asking for advices for how to do proper collisions and physics. I don't want to use any external libraries.

Thanks in advance!

\$\endgroup\$
2
  • \$\begingroup\$ Just for clarity, is the grenade bound by tiles or is it free-moving? \$\endgroup\$
    – newton1212
    Jun 14, 2015 at 11:10
  • \$\begingroup\$ It is free-moving. \$\endgroup\$
    – CodezMe
    Jun 14, 2015 at 11:12

1 Answer 1

1
\$\begingroup\$

The simplest answer will be: Use 3D Colliders

It's possible to freeze one of the axes (z-axis) when the grenade is bouncing back from a 3D Collider, hence it will only moves in x-axis and y-axis.

Apply a sphere collider and rigidbody(with z-axis frozen) on the grenade, a cube collider with thin z-scale on the roof, when the grenade is thrown to the roof, collisions occur and the grenade will be bounced back.

\$\endgroup\$
8
  • \$\begingroup\$ I have no idea how I'm gonna do that in java (yes, I'm using java). \$\endgroup\$
    – CodezMe
    Jun 14, 2015 at 12:19
  • \$\begingroup\$ May I ask what engine are you using? \$\endgroup\$
    – Fatty Mieo
    Jun 14, 2015 at 12:21
  • 1
    \$\begingroup\$ In this case, either you write your own 3DPhysics, or instantly transforming the position(without the Physics Logic). EDIT: To use this, divide the roof into square tiles. When a grenade falls on a certain tile, move the grenade backwards a few tiles from the roof. \$\endgroup\$
    – Fatty Mieo
    Jun 14, 2015 at 12:52
  • 1
    \$\begingroup\$ @CodezMe Within the format of a Q&A site, we won't be able to tell you how to build a whole physics engine from scratch. Try reading up on tutorials/books like "Realtime Collision Detection" and ask if you encounter a specific issue or bug you need help sorting out. \$\endgroup\$
    – DMGregory
    Jun 14, 2015 at 12:54
  • 1
    \$\begingroup\$ Image for Tiles Explaination \$\endgroup\$
    – Fatty Mieo
    Jun 14, 2015 at 13:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .