gen2brain / raylib-go

Go bindings for raylib, a simple and easy-to-use library to enjoy videogames programming.
zlib License
1.6k stars 164 forks source link

Physics ? #19

Closed Eon1 closed 3 years ago

Eon1 commented 6 years ago

I'm trying to use voya's chipmunk physics like in one of the physics examples. I'm having a hard time with it though because it's over 3 years old and a lot of the stuff that is in chipmunk doesn't seem to be in go version. I'm trying to use AddCollisionHandler . Is there a newer version of chipmunk-go or somewhere to get documentation on how to implement a collision handler ?

raysan5 commented 6 years ago

Just out of curiosity, there is a physics module designed for raylib: physac.

And here there are some usage examples: https://github.com/raysan5/raylib/tree/master/examples/physac

gen2brain commented 6 years ago

@Eon1 Examples use voya's chipmunk and box2d-lite, you can try with https://github.com/jakecoffman/cp, that is a newer rewrite of chipmunk in Go, and looks maintained.

Physac in raylib-go is still a work in progress, didn't have time to finish it. I wanted to finish rewrite and to add physac examples, together with new cp chipmunk examples. That is on TODO list but not sure when will that happen.

Eon1 commented 6 years ago

@gen2brain I saw the jakecoffman copy and tried to start using it. But did run into some problems(nothing was colliding ) it's a bit different than voya's version. I'll give it another shot.

@raysan5 physac looks really cool i'll keep my eye out for the go port @gen2brain :) .

thanks for the quick response guys .

gen2brain commented 6 years ago

Physac in raylib-go is improved now, and I added examples. But, something is still not right, there is a bug somewhere, bodies are getting some velocity or forces where it shouldn't. I need to review everything again, but don't have time for that now.

gen2brain commented 6 years ago

This is how currently works: http://81.4.106.254/screen01.mp4 http://81.4.106.254/screen02.mp4

And it should work like this: http://81.4.106.254/screen01-orig.mp4 http://81.4.106.254/screen02-orig.mp4

I am not sure where to start, some help would be much appreciated!

raysan5 commented 6 years ago

Hi @gen2brain, probably @victorfisac has some idea on this issue...

gen2brain commented 3 years ago

There are physics examples in the repo, physac rewrite still doesn't work properly, I will open a new issue for that.