beastie - Header only collision detection library for Ogre

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: beastie - Header only collision detection library for Og

Post by betajaen »

kneeride wrote:betajaen you rock!! This is very cool.

I've been reluctant to integrate a physics engine because it would have been overkill for what I need. I also thought the memory would be overkill because there needs to be 2 scene managers (1 for phsyics and 1 for ogre).

I've been using MOC for ray to mesh but I'm really hanging out for this one:

>> Box v.s. Box and Plane intersection.

Can you please also consider: Box vs Sphere :-)

Don't worry, I'll be adding spheres/ellipsoids from this code article.

I'm just working on changing the "node" system a bit. I want it to be more like Ogre's where you can attach multiple objects, and of different types. My system just assumes you want a mesh and does it automatically. I'll probably get to boxes and spheres then.

I'm also aiming for speed. Every microsecond counts.
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: beastie - Header only collision detection library for Og

Post by Zonder »

betajaen wrote:
kneeride wrote:betajaen you rock!! This is very cool.

I've been reluctant to integrate a physics engine because it would have been overkill for what I need. I also thought the memory would be overkill because there needs to be 2 scene managers (1 for phsyics and 1 for ogre).

I've been using MOC for ray to mesh but I'm really hanging out for this one:

>> Box v.s. Box and Plane intersection.

Can you please also consider: Box vs Sphere :-)

Don't worry, I'll be adding spheres/ellipsoids from this code article.

I'm just working on changing the "node" system a bit. I want it to be more like Ogre's where you can attach multiple objects, and of different types. My system just assumes you want a mesh and does it automatically. I'll probably get to boxes and spheres then.

I'm also aiming for speed. Every microsecond counts.
Yes I remember reading that article god knows how many years ago I was developing with Geforce 2 and 3 was just out?? I never implemented it in my collision engine at the time it was the last thing on my list but I split from the team I was working with :)
There are 10 types of people in the world: Those who understand binary, and those who don't...
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: beastie - Header only collision detection library for Og

Post by Kojack »

doing a box -> sphere check is only a matter of checking to see if a points distance from the center of the sphere is below it's radius
No, it takes more than that.
It's possible for the sphere to intersect the sides of the box without ever going near a box corner.

Looks cool, maybe I won't have to modify Moc now to be more efficient (it transforms every triangle into world space, instead of transforming the ray into local space like beastie does).
User avatar
Herb
Orc
Posts: 412
Joined: Thu Jun 04, 2009 3:21 am
Location: Kalamazoo,MI
x 38

Re: beastie - Header only collision detection library for Og

Post by Herb »

I take it, this is more efficient (faster) and easy to use than the "minimal ogre collision library"?

http://www.ogre3d.org/tikiwiki/Minimal+ ... =Libraries
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: beastie - Header only collision detection library for Og

Post by betajaen »

It's faster (about 1.5x-2x) due to it transforming the ray to localspace and caching the triangles of the loaded meshes.
reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland
x 5

Re: beastie - Header only collision detection library for Og

Post by reptor »

Thumbs up for this new project. I hope it a good life!
User avatar
SunSailor
Gnoll
Posts: 699
Joined: Sun Jan 02, 2005 5:45 pm
Location: Velbert, Germany
x 2
Contact:

Re: beastie - Header only collision detection library for Og

Post by SunSailor »

Any news or updates on this project, or is it elapsed? If so, any recommendation for an alternative? Or is it work stable and simply didn't need any further update?
Online-Distribution with Jade-DS, Ogre-Wrapper included.
Follow me on Twitter for updates!
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: beastie - Header only collision detection library for Og

Post by betajaen »

It's fine as it is. I was going to do box/plane/sphere collisions but I'm probably not now, but just for raycasting it's pretty fast and stable.
Tinnus
Halfling
Posts: 45
Joined: Fri Nov 02, 2007 3:23 am
x 4

Re: beastie - Header only collision detection library for Og

Post by Tinnus »

Kojack wrote:
doing a box -> sphere check is only a matter of checking to see if a points distance from the center of the sphere is below it's radius
No, it takes more than that.
It's possible for the sphere to intersect the sides of the box without ever going near a box corner.

Looks cool, maybe I won't have to modify Moc now to be more efficient (it transforms every triangle into world space, instead of transforming the ray into local space like beastie does).
I'm pretty sure taking all faces from the box and doing face<->center_of_sphere distance is enough: if a point of the box is inside the sphere, then a point of a face must be; then if a point of a face is inside the sphere, then the face's point closest to the center of the sphere must be as well.

Doing face<->point distance is a matter of projecting the point to the plane of the face; then if it's inside it, do center<->plane distance (easy), and if it's outside, you can do point<->edge with the edges of the face.

Of course that's probably not the fastest way to do it though.
Zwart
Gnoblar
Posts: 4
Joined: Mon Oct 04, 2010 4:26 pm

Re: beastie - Header only collision detection library for Og

Post by Zwart »

Hi,
I have a question about beasty. I'm looking to it because I need to detect a simple collision between meshs and I though I would be able to use it in my scene but at first sight I haven't find any function to move my node in my tree so my question is, do I need to have all my objects static to compute any raytracing with beasty or do I miss in the code ??

Thanks
jonim8or
Goblin
Posts: 287
Joined: Mon Dec 08, 2008 4:49 pm
x 10

Re: beastie - Header only collision detection library for Og

Post by jonim8or »

Does beastie also work with manualobjects?
mikekknd
Gnoblar
Posts: 8
Joined: Fri Aug 06, 2010 1:20 am
Contact:

Re: beastie - Header only collision detection library for Og

Post by mikekknd »

Very nice work but is there any mesh scaling function? It seems like the mesh is not scaled properly and the collision is detecting the unscaled mesh...
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Re: beastie - Header only collision detection library for Og

Post by Beauty »

Nice project :D

Maybe some parts of your library are interesting for the sensor simulation of my underwater application. So I can learn from it.
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
User avatar
voyvf
Kobold
Posts: 28
Joined: Sat Jul 04, 2009 4:01 am
Location: United States
x 2
Contact:

Re: beastie - Header only collision detection library for Og

Post by voyvf »

Doh! Neither g++ 4.4.5 nor clang version 2.9 (trunk 124442) appear to grok the template declarations. ):

I attempted to attach the error but the forum doesn't appear to allow .txt or .out file extensions - here is the gist: https://gist.github.com/810137
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: beastie - Header only collision detection library for Og

Post by betajaen »

It's because I've literally twisted and turned C++ in a way, it may as well be BASIC. Visual Studio is a bit of a pushover, where as G++ is more hardened against my "style" of programming.

I don't have quick and easy idea of fixing it for you though. The long alternative would be to create a cpp file and declare all the functions in that and remove all the templates; just like proper C++ code. ;)
User avatar
voyvf
Kobold
Posts: 28
Joined: Sat Jul 04, 2009 4:01 am
Location: United States
x 2
Contact:

Re: beastie - Header only collision detection library for Og

Post by voyvf »

betajaen wrote:It's because I've literally twisted and turned C++ in a way, it may as well be BASIC. Visual Studio is a bit of a pushover, where as G++ is more hardened against my "style" of programming.

I don't have quick and easy idea of fixing it for you though. The long alternative would be to create a cpp file and declare all the functions in that and remove all the templates; just like proper C++ code. ;)
Darn, I was hoping to write some Python bindings for this. Do you know if I'll run into the same issue with Gorilla? I've got time to kill and need a break from my normal project. :D
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: beastie - Header only collision detection library for Og

Post by betajaen »

No, Gorilla doesn't use templates at all. As far as I'm aware, Gorilla is multiplatform.

I only used templates like that, so I could reference functions to classes that haven't been declared yet. Like I said; creating a cpp file, with all of the functions defined in it, would be the most appropriate way to go, but at the time I just wanted a single header file.
User avatar
voyvf
Kobold
Posts: 28
Joined: Sat Jul 04, 2009 4:01 am
Location: United States
x 2
Contact:

Re: beastie - Header only collision detection library for Og

Post by voyvf »

betajaen wrote:No, Gorilla doesn't use templates at all. As far as I'm aware, Gorilla is multiplatform.

I only used templates like that, so I could reference functions to classes that haven't been declared yet. Like I said; creating a cpp file, with all of the functions defined in it, would be the most appropriate way to go, but at the time I just wanted a single header file.

Awesome! I'll hit Gorilla first and then move back to beastie, as I need a GUI* just as much as I need collision. :D

Thanks!

EDIT: * Specifically a drop down hud/console.
mikekknd
Gnoblar
Posts: 8
Joined: Fri Aug 06, 2010 1:20 am
Contact:

Re: beastie - Header only collision detection library for Og

Post by mikekknd »

I just found something interesting recently. The collision detection become unstable when the mesh uses multiple materials. Do anyone encounter the same problem or is it just me?
User avatar
suny2000
Halfling
Posts: 72
Joined: Sun Sep 06, 2009 12:36 pm
x 12
Contact:

Re: beastie - Header only collision detection library for Og

Post by suny2000 »

Hi !
I'm using Beastie in a little project, and I'm wondering if this library is still under developement.
More specifically, the integration of Paul Nettle work (ellipsoid character controller), which is the only really missing feature in my opinion.
Thanks again for this work,
S.
http://bulostudio.com: website and devlog of a small indie studio working on SHMUP CREATOR
https://twitter.com/bulostudio : follow me on twitter!
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: beastie - Header only collision detection library for Og

Post by betajaen »

I'm afraid not. I never got around to doing it, and I'm working on different projects now.

Perhaps you could use a physics engine instead - bullet for example?
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: beastie - Header only collision detection library for Og

Post by Zonder »

Tinnus wrote:
Kojack wrote:
doing a box -> sphere check is only a matter of checking to see if a points distance from the center of the sphere is below it's radius
No, it takes more than that.
It's possible for the sphere to intersect the sides of the box without ever going near a box corner.

Looks cool, maybe I won't have to modify Moc now to be more efficient (it transforms every triangle into world space, instead of transforming the ray into local space like beastie does).
I'm pretty sure taking all faces from the box and doing face<->center_of_sphere distance is enough: if a point of the box is inside the sphere, then a point of a face must be; then if a point of a face is inside the sphere, then the face's point closest to the center of the sphere must be as well.

Doing face<->point distance is a matter of projecting the point to the plane of the face; then if it's inside it, do center<->plane distance (easy), and if it's outside, you can do point<->edge with the edges of the face.

Of course that's probably not the fastest way to do it though.
i never answered this I realised. You can just use the center of the box and the distance to it's side and the radius of the sphere for the intersect.
There are 10 types of people in the world: Those who understand binary, and those who don't...
User avatar
suny2000
Halfling
Posts: 72
Joined: Sun Sep 06, 2009 12:36 pm
x 12
Contact:

Re: beastie - Header only collision detection library for Og

Post by suny2000 »

I just found something interesting recently. The collision detection become unstable when the mesh uses multiple materials. Do anyone encounter the same problem or is it just me?
I'm experiencing the same problem. I'm thinking that beastie can't properly test collisions on more than 2 sub-meshes...

If someone knows how to modify this behavior, don't hesitate to post the solution !
S.
http://bulostudio.com: website and devlog of a small indie studio working on SHMUP CREATOR
https://twitter.com/bulostudio : follow me on twitter!
Post Reply