Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Collision Demo  (Read 1524 times)
0 Members and 1 Guest are viewing this topic.
Offline DavidYazel

Junior Devvie




Java games rock!


« Posted 2003-12-24 23:16:05 »

It is still early yet in development, but the Collision code has reached a bit of a milestone.  I have committed the code and a demo.

The collision code operates compeltely seperately from the core scenegraph and renderer.  Links between models and the collision system are called ColliderNodes which are instantiated with a link to the scenegraph node.  Each colllider node is marked as being static or dynamic for optimization purposes.  If a node is marked as movable then the collision system is free to adjust the node's transform group parent to move the model as necessary.  

Two policies are set for each node.  One policy controls the method to be used when collided against and one for when this node collides with another.  The available policies are geometry, bounding sphere, ellipsoid and eventually bounding box.  So you can moving objects set with a collider policy of ellipsoid and have their collidee policy as geometry.  I don't have geometry to geometry collision yet, but it will be forthcoming.

You can attach forces to each node which act on the node during runtime.  For example the ForceGravity class will act as the pull of gravity on the node.

Collision nodes are registered with the collision system and then once a frame you call CollisionSystem.newFrame(long ellapsedTime) and it then handles everything else.

There is still a ton to due before this can be used in your projects.  Currently the act of collision is hard coded to impart a portion of the energy to the colidee with almost 100 percent energy conservatiion.  There is no friction and no mass yet on the nodes.  These effects will all be exposed through an interface so you can setup the collision system with whatever physics you want.

The demo is of a scene with an encosing cube to bound the contents.  There are 4 static collidees in the scene, one sphere and 3 cubes.  There are 5 colliders in the scene which are spheres, each with the force of gravity applied.  The demo starts out by dropping the 5 balls from about 10 meters up.  They bounce around and collide with each other and the geometry.  There is a lack of smoothness due partially to the lack of a high res timer, partially do to GC since I have not fully optimized for leaking objects (there is lots and lots of vector math which requires lots and lots of temp tuples).  The demo seems to stablize after a few seconds and run very smoothly though.



The demo is called Xith3DCollisionDropTest

A bit of how it works.  With each CollisionNode you must supply a Collider if you have a policy of GEOMETRY specified.  A reference collider of BiTreeCollider has been written which can be used to manage the triangles in a spatial BiTree.  Colliders use a ColliiderGeometry to store access to the raw geometry used.  There is a method in ColliderGeometry which can take a model (root node in a scene) and pull out the triangles, calculate their bounding spheres and their planes and store them.  The BiTree indexes these triangles into an axis aligned  plane seperated binary tree.  The BiTree can be save and loaded very fast because all its data is in a few arrays of floats and ints.

Each frame the CollisionSystem takes each movable ColliderNode and assembles a set of potential impacts.  Each of these impacts is checked for actuall collisions and a set of collision surfaces are assembled.  Each collision surface has the distance to the collision, the plane of collision and whether it is a EDGE, POINT, EMBEDDED or SURFACE.  These catagories are very important for implementations that want to do something like slide against a surface versus bouncing.

Hope you find it interesting stuff... personally I have found this to be much more challenging technically than the renderer itself.  

BTW with this addition of code we now have over 64,000 lines of code in Xith3D.

Dave

David Yazel
Xith3D Project Founder
http://xith3d.dev.java.net

It may look complicated, but in the end it is just a bunch of triangles
Offline DavidYazel

Junior Devvie




Java games rock!


« Reply #1 - Posted 2003-12-25 22:34:43 »

I commited a fix which addresses some performance problems.  The calculation for the list of potential colliders is now much more constrained.

David Yazel
Xith3D Project Founder
http://xith3d.dev.java.net

It may look complicated, but in the end it is just a bunch of triangles
Offline DavidYazel

Junior Devvie




Java games rock!


« Reply #2 - Posted 2003-12-26 03:49:48 »

Just commited another set of fixes which provided massive performance improvements.  

Just sitting here watching the demo and smoking a nice cigar...

it's hypnotic... tell me if you don't agree!

David Yazel
Xith3D Project Founder
http://xith3d.dev.java.net

It may look complicated, but in the end it is just a bunch of triangles
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Yuri Vl. Gushchin

Senior Devvie




Speak Java!


« Reply #3 - Posted 2003-12-26 05:15:03 »

Yes, now this works really well.

Yuri

Yuri Vl. Gushchin
JProof Group
Offline Daath

Junior Devvie




Java games rock!


« Reply #4 - Posted 2003-12-26 15:02:35 »

Tried to play with a bit and everything seems to work. Good stuff!!!
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #5 - Posted 2003-12-28 16:12:59 »

This sure is nice looking! Makes me feel a bit like running ODE the first time  Cheesy

There's a fair bit of code in com.xith3d.collider, I wonder if your collision library could be exploited for generating contact information for a pure Java physics engine (or make full/partial Java port of ODE, without OPCODE).
Offline Jens

Senior Devvie




Java for games!


« Reply #6 - Posted 2003-12-28 17:19:39 »

Works for me too and is nice.  Smiley

Xith3D Getting Started Guide (PDF,HTML,Source)
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (29 views)
2014-11-22 12:13:56

xFryIx (71 views)
2014-11-13 12:34:49

digdugdiggy (50 views)
2014-11-12 21:11:50

digdugdiggy (44 views)
2014-11-12 21:10:15

digdugdiggy (38 views)
2014-11-12 21:09:33

kovacsa (62 views)
2014-11-07 19:57:14

TehJavaDev (67 views)
2014-11-03 22:04:50

BurntPizza (64 views)
2014-11-03 18:54:52

moogie (80 views)
2014-11-03 06:22:04

CopyableCougar4 (80 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!