Coder Social home page Coder Social logo

kevinmoran / gjk Goto Github PK

View Code? Open in Web Editor NEW
85.0 85.0 17.0 1.14 MB

Basic 3D collision detection implementation using the Gilbert–Johnson–Keerthi distance algorithm along with the Expanding Polytope Algorithm

License: Other

Objective-C 10.12% Makefile 0.88% C++ 6.90% GLSL 0.07% C 82.03%

gjk's People

Contributors

kevinmoran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gjk's Issues

Linux build

Nice demo. This is the most straightforward implementation I've seen, so thanks for sharing :). I'm using it as reference for my current game engine project. Built the project on Linux with the following patch.

diff --git a/Makefile b/Makefile
index fc91c36..ad6d07b 100644
--- a/Makefile
+++ b/Makefile
@@ -59,8 +59,8 @@ else
                PREBUILD = @mkdir -p $(BUILD_DIR)
                endif
        else
-               #--- LINUX --- TODO?
-               $(error ERROR: Unsupported build platform)
+               #--- LINUX ---
+               SYS_LIBS=-lGLEW -lGL -ldl -lglfw
        endif
 endif
 
diff --git a/gl_lite.h b/gl_lite.h
index dbd95d4..5c4554c 100644
--- a/gl_lite.h
+++ b/gl_lite.h
@@ -34,6 +34,8 @@
 #include <OpenGL/gl3.h>
 #else //LINUX & WIN32
 
+#include <cstdio>
+
 #include <stddef.h>
 
 //This doesn't work for some reason :/

License?

Hi there~

Are you planing to add a license to this project so others might can use your code for their own project?

Personally I would appreciate a very liberal license like MIT :)

if the cylinder pos Y!=0, the collision detection output is wrong

when the cylinder pos.y is not zero, the real collision model is higher than it should be in Y derection.
such as I set the Y as

const vec3 cylinder_pos[NUM_CYLINDERS] = {
			vec3( 6, 3, 0),
			vec3(-6, 0, 0),
			vec3( 0, 0,-6)
		};

the player capsule can get through the first Cylinder[0], but can not get through a space higher than the mesh.

Max Iterations?

Hi, nice code, I am using it as reference for my game engine. I saw same cases where the GJK implementation use a while(true) but you are limiting the number of iterations instead:

GJK/GJK.h

Line 59 in b38d923

for(int iterations=0; iterations<GJK_MAX_NUM_ITERATIONS; iterations++)

I would like to know what is the purpouse of that. Could the algorithm run forever if we use while(true)?

Thank you for your help!

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.