Collision planes confusion

Posted by Jeffrey on Game Development See other posts from Game Development or by Jeffrey
Published on 2012-11-29T16:49:08Z Indexed on 2012/11/29 17:19 UTC
Read the original article Hit count: 283

Filed under:
|

I'm following this tutorial by thecplusplusguy and in the linked video he explain that for example for the world basement and walls we need to create the actual rendered (shown to the player) walls and then duplicate them, place them in the same coordinates as the rendered walls and call them collision (by defining their material to collision). Then it defines in the Object loader function that those objects with material == collision are collision planes and should not be rendered but just used to check collision.

Now I'm pretty confused. Why would we add this kind of complexity to a problem that can easily be solved by a simple loadObject(string plane_object, bool check_collision);:

  1. Creating only the walls object (by loading .obj file in plane_object)
  2. Define them also as collision planes whenever the check_collision is set to true

In this case we have lowered the complexity of his method and make it more flexible and faster to develop (faster because we don't always have to make a copy for each plane and flexible because we don't hardcode the Object loader). The only case in which this method could not work is when we need hidden collision planes, and for that we could modify the loadObject() function like this: loadObject(string plane_object, bool check_collision = true, bool hide_object = false);

  1. Creating only the walls object (by loading .obj file in plane_object)
  2. Define them also as collision planes whenever the check_collision is set to true
  3. And add the ability to actually show the object or hide it based on hide_object.

The final question is: am I right? What would the possible problem encountered with my solution versus his?

© Game Development or respective owner

Related posts about c++

Related posts about collision-detection