Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (604)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (652)
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 1698 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.


David Yazel
Xith3D Project Founder

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

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

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 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.

SHC (24 views)
2015-08-01 03:58:20

Jesse (19 views)
2015-07-29 04:35:27

Riven (40 views)
2015-07-27 16:38:00

Riven (21 views)
2015-07-27 15:35:20

Riven (24 views)
2015-07-27 12:26:13

Riven (14 views)
2015-07-27 12:23:39

BurntPizza (36 views)
2015-07-25 00:14:37

BurntPizza (46 views)
2015-07-24 22:06:39

BurntPizza (28 views)
2015-07-24 06:06:53

NoxInc (36 views)
2015-07-22 22:16:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 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‑
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!