Giter VIP home page Giter VIP logo

meshcollision's Introduction

Mesh_Collision

3D collision detection, axis-aligned bounding boxes (AABB)

The main runs in the MeshCollision/main.cpp, we added the function checkCollision() that will find if exists, a collision between the shapes and will draw the smallest bounding boxes that collide.

In order to detect a collision we used a kd-tree, built from the vertices. Each node stores in addition to the vertices also the center, width, height and depth of the bounding box for the node, calculated from the sub-tree.

In addition to the drawing of the smallest bounding boxes in a collision, every shape holds it's mesh and a cube bounding mesh that is constructed from the root of the kdtree for that shape. Every frame we'll draw both meshes.

Project structure:

engine

This is the under-the-hood part that enables rendering meshes.

  • mesh.cpp
    • Mesh represention via openGL.
  • shader.cpp
    • Shader manager.
  • obj_lodaer.cpp
    • .obj File parser.
    • Fast mesh simplification.
  • Scene.cpp
    • Scene represention.
  • CollisionDetection.h
    • Collision Detection algorithm calculations.
  • KDTree.cpp
    • Adjusted kd-tree for collision detection.

MeshCollision

The actual MeshCollision implementation.

  • main.cpp
    • Entry point.

Usage:

Keyboards controls:

Use arrows to control the movable shape around.

Use W,A,S,D to rotate the camera.

Q - Exit the program.

'Z' - Move the camera left.

'X' - Move the camera right.

'C' - Zoom into the scene.

'V' - Zoom out of the scene.

Future Possible Upgrades

  • Use other structures for collision detection such as a BVH.
  • Calculate the collsion enter,exit and stay.
  • Have the calculation take less time.

Images:

meshcollision's People

Contributors

meirshomron avatar

Stargazers

Noble_d_Amour avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.