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
Contact:

beastie - Header only collision detection library for Ogre

Post by betajaen » Wed Jul 14, 2010 11:28 am

Image

Crivvens! What is Beastie?

Beastie is a C++ based simplified collision detection library for the Ogre3D
graphics engine, and it is neatly packaged in a single header, beastie.h.

"Beastie" should be always pronounced in a Glaswegian accent.

It only detects collisions and does not respond to them as you would typically
encounter in a more fully featured physics engine or more advanced collision
library.

However the detections are accurate and are optimised, building some response
code on top of beastie shouldn't be to difficult, an example of some of this
is in the "beastie.example.cpp" test application that can be found at the beastie
Git repository.

Beastie only uses Ogre as a dependency, and is developed with Ogre 1.7 in mind;
but should work with any 1.x version.

Beastie is released under the MIT licence.

Gessa Download!

Beastie only comes in one file "beastie.h", alternatively a complete Sample may be downloaded.

Beastie is hosted and versioned by GitHub.

Further Documentation and information can be found there.

Awayan'boilyirheid

Beastie is very simple to use, and requires the minimal amount of code to setup.

For example; this is how you would raycasting:

Code: Select all

beastie::collision_tree tree = OGRE_NEW collision_tree();

tree->createNode("tudorhouse.mesh", Ogre::Vector3(0,550,0);
ray_query result;
line ln(Ogre::Vector3(0,25000,0), Ogre::Vector3(0,-1,0), 25000);
tree->intersect(ln, result);

Additionally Beastie comes with an example application, using the OgreBites sample
framework.

The example is a self-installing-when-compiled Ogre Sample. Simply compile the Sample
(in the visual studio directory) and it will copy itself and self-install it self into your Ogre
Samples folder. Run the SampleBrowser application and you'll find "Beastie Example" under
the "Collision Detection" section

Smashin-intit

Beastie will be worked upon the future. My rough To-do list is as follows:

- Bug fixes.
- Box v.s. Box and Plane intersection.
- Further optimisation of raycasting.
- Jacmoe has convinced me to incorporate the works of Paul Nettle; more specifically the
ellipsoid character controller.
0 x

User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1888
Joined: Sun Mar 08, 2009 5:25 am
x 34

Re: beastie - Header only collision detection library for Og

Post by mkultra333 » Wed Jul 14, 2010 11:38 am

Sounds really interesting. Can it handle collisions against any arbitrary mesh or disjointed triangle soup? (Not that I really need collisions against disjointed triangle soups, I'm just curious.) Can you do a mesh-mesh collisions?
0 x
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.

User avatar
boyamer
Orc
Posts: 459
Joined: Sat Jan 24, 2009 11:16 am
Location: Italy

Re: beastie - Header only collision detection library for Og

Post by boyamer » Wed Jul 14, 2010 11:40 am

Very nice project,can't wait to give a look to it.

Nice work betajaen
0 x

User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
Contact:

Re: beastie - Header only collision detection library for Og

Post by betajaen » Wed Jul 14, 2010 11:42 am

mkultra333 wrote:Sounds really interesting. Can it handle collisions against any arbitrary mesh or disjointed triangle soup? (Not that I really need collisions against disjointed triangle soups, I'm just curious.) Can you do a mesh-mesh collisions?
Nope; No mesh v.s. mesh collisions, I'm afraid. It would be too difficult to implement and very slow to run.

It's more rays v.s. meshes/boxes/planes at the moment.
0 x

User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain

Re: beastie - Header only collision detection library for Og

Post by Xavyiy » Wed Jul 14, 2010 12:17 pm

Very nice betajaen =)

I think this little library will be a really useful for a wide range of people, specially people who is starting in 3D programing and even experienced users that wants a simple, but robust, collision detection library for little demos!
0 x

User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 3
Contact:

Re: beastie - Header only collision detection library for Og

Post by AshMcConnell » Wed Jul 14, 2010 12:37 pm

LOL @ Awayan'boilyirheid

Looks great, should be useful to a lot of people!

All the best,
Ash
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19261
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
Contact:

Re: beastie - Header only collision detection library for Og

Post by sinbad » Wed Jul 14, 2010 1:01 pm

Is there anything betajaen can't fit into a single header file? ;)

Nice work mate.
0 x

User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
Contact:

Re: beastie - Header only collision detection library for Og

Post by Klaim » Wed Jul 14, 2010 1:53 pm

Seems a useful tool for not-needing-physic-lib projects! :D
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: beastie - Header only collision detection library for Og

Post by jacmoe » Wed Jul 14, 2010 2:22 pm

Like I said to Betajaen earlier: this is great! :)

Since OgreOpcode does do soup versus soup collision detection, maybe the two could be combined?
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
Contact:

Re: beastie - Header only collision detection library for Og

Post by betajaen » Wed Jul 14, 2010 2:59 pm

I'm probably going to leave mesh v.s. mesh collisions to last. It is possible, but I'm really concerned about performance. I mean PhysX is based upon OpCode, but it doesn't do mesh v.s. mesh collisions.

What I may do is do allow very simple convex/concave hull collisions with vertices less than 16, but I want to do OBB boxes and that character controller first.
0 x

User avatar
Ruud v A
Gremlin
Posts: 150
Joined: Mon Jan 28, 2008 6:44 pm
Location: The Netherlands
Contact:

Re: beastie - Header only collision detection library for Og

Post by Ruud v A » Wed Jul 14, 2010 3:18 pm

One question:
betajaen wrote: "Beastie" should be always pronounced in a Glaswegian accent.
How is that? I am a non-native speaker so an example would be appreciated :)

It looks great, especially the single header file! No mess, just one include and it works. I like it.
0 x

User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 3
Contact:

Re: beastie - Header only collision detection library for Og

Post by AshMcConnell » Wed Jul 14, 2010 3:21 pm

Ruud v A wrote:One question:
betajaen wrote: "Beastie" should be always pronounced in a Glaswegian accent.
How is that? I am a non-native speaker so an example would be appreciated :)

It looks great, especially the single header file! No mess, just one include and it works. I like it.
BeeeeStaaaay :D
0 x

User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
Contact:

Re: beastie - Header only collision detection library for Og

Post by betajaen » Wed Jul 14, 2010 3:32 pm

AshMcConnell wrote:BeeeeStaaaay :D
http://www.youtube.com/watch?v=Nrmcxa1yBec
0 x

User avatar
Ruud v A
Gremlin
Posts: 150
Joined: Mon Jan 28, 2008 6:44 pm
Location: The Netherlands
Contact:

Re: beastie - Header only collision detection library for Og

Post by Ruud v A » Wed Jul 14, 2010 3:51 pm

AshMcConnell wrote:BeeeeStaaaay :D
Ah, thanks!
0 x

User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
Contact:

Re: beastie - Header only collision detection library for Og

Post by betajaen » Wed Jul 14, 2010 5:59 pm

New commit
Changes:

- Added set origin, direction and length functions in line
- Added alternative Raycasting algorithm
The new ray casting algorithm is an adapted version Tomas Möller's "Fast Minimum Storage Ray-Triangle Intersection" which is used in Opcode and possibly PhysX.
0 x

User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
Contact:

Re: beastie - Header only collision detection library for Og

Post by Jabberwocky » Wed Jul 14, 2010 7:09 pm

cool stuff.
0 x
Image

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: beastie - Header only collision detection library for Og

Post by jacmoe » Wed Jul 14, 2010 7:42 pm

This is coolness! :)

Makes me resurrect OgreOpcode again...
Would be interesting to benchmark the two.
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: beastie - Header only collision detection library for Og

Post by jacmoe » Wed Jul 14, 2010 7:43 pm

But first:
A character controller demo. :)
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
Contact:

Re: beastie - Header only collision detection library for Og

Post by betajaen » Wed Jul 14, 2010 7:50 pm

jacmoe wrote:Would be interesting to benchmark the two.
I did some basic benchmarking.

Using the TudorDemo and in clicking in nowhere particular. I timed each ray cast, then I collected them and got an average.

The adapted Ogre raycasting code takes 45μs
The adapted Opcode/PhysX code takes 50μs

I am surprised about the second, considering how simpler the code is.
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: beastie - Header only collision detection library for Og

Post by jacmoe » Wed Jul 14, 2010 7:52 pm

I don't give a lot of credits to that kind of benchmarking..

Look to the CDTestFramework which ships with Bullet, if you want good benchmarks. :)

Would be cool to throw in a Beastie example.
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

Shadow007
Gremlin
Posts: 185
Joined: Sat May 07, 2005 3:27 pm

Re: beastie - Header only collision detection library for Og

Post by Shadow007 » Thu Jul 15, 2010 10:40 am

Great work Betajaen ! One question though :
Looking at your code, I see that you based a 1 axis split submesh computation/splitting on the Y axis ... Is there any reason to stop there and not subdivide further, or simply cut with all 3 axes giving 8 submeshes ?
0 x

User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
Contact:

Re: beastie - Header only collision detection library for Og

Post by betajaen » Thu Jul 15, 2010 10:59 am

Shadow007 wrote:Looking at your code, I see that you based a 1 axis split submesh computation/splitting on the Y axis ... Is there any reason to stop there and not subdivide further, or simply cut with all 3 axes giving 8 submeshes ?
I wanted to see if it made any difference, and it does a bit.

I'm taking a different approach now and making the meshes part of the octtree directly, rather represented as whole by an AABB. That should skip over some existing code and same on some time on finding the proper mesh fragment for raycasting.
0 x

kneeride
Bugbear
Posts: 807
Joined: Sun May 14, 2006 2:24 pm
Location: Melbourne, Australia

Re: beastie - Header only collision detection library for Og

Post by kneeride » Fri Jul 16, 2010 4:35 am

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 :-)
0 x

User avatar
Matheus Martino
Gremlin
Posts: 164
Joined: Mon Sep 07, 2009 10:44 pm
Location: Brazil
Contact:

Re: beastie - Header only collision detection library for Og

Post by Matheus Martino » Fri Jul 16, 2010 7:43 am

I think betajaen expect you to define a box around your sphere.
0 x
Excuse me if my english fail!

User avatar
Zonder
Ogre Magi
Posts: 1133
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 22

Re: beastie - Header only collision detection library for Og

Post by Zonder » Fri Jul 16, 2010 8:39 am

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
0 x
There are 10 types of people in the world: Those who understand binary, and those who don't...

Post Reply