Collision detection

Software: Away3D 4.x

Fossor, Newbie
Posted: 08 September 2011 10:54 PM   Total Posts: 21

What i basically need is a set of tools to check camera position against game map object without any physics.
So the question is, with a current state of away3d 4 is it possible make collision detection using library classes? If not - which part is missing? Otherwise where do I start, cause i have not been able to find any examples on the subject. I know there is Octree class, but i have no clue how to use it.

   

Fossor, Newbie
Posted: 15 September 2011 02:36 PM   Total Posts: 21   [ # 1 ]

Nobody? I really need my brand new game to hit the stores before Diablo 3, not a big deal you say, but I have not even started! smile

Ok, more specific question(s):
How do I know in which OctreeNode my moving object resides in each period of time? Should I use EntityCollector somehow? Should I extend PartitionTraverser and build my own traverser?
Thanx.

   

Alex Bogartz, Sr. Member
Posted: 15 September 2011 03:17 PM   Total Posts: 216   [ # 2 ]

So one strategy is to make a top down shot of your map and color it black and white in Photoshop.  Then take the x and z properties of your camera and apply it to the map as x and y.  Test the pixel color.  If it’s black, you’ve hit a wall.

   

Fossor, Newbie
Posted: 15 September 2011 03:46 PM   Total Posts: 21   [ # 3 ]

Thanx, but, I’am actually looking for a solution using away3d classes or maybe some of them.
Color map is ok but only applies in cases where you have not up and down movement, this regrettably does not fits in my case.

   

Avatar
Alejandro Santander, Administrator
Posted: 15 September 2011 04:22 PM   Total Posts: 414   [ # 4 ]

I am not sure if you can use native Away3D 4.x classes to detect collisions. Maybe there is, but I am not yet aware of them. Perhaps other team members are?

You could very easily detect collisions using aabb’s, that is, axis aligned bounding boxes. If you need a bit more precision, you could use the more complicated, but not too complicated obb, oriented bounding box, collision detection technique. I discuss these in one of my blog posts: http://www.lidev.com.ar/obb-collision-detection/

Away3D 4.x does provide good bounding box info, including way to visualize these.

hth

   

Fossor, Newbie
Posted: 15 September 2011 06:15 PM   Total Posts: 21   [ # 5 ]

Thank you, Alejandro. Very nice example. But, the actual collision test, i guess, will be step 2 for me.

The first step i need is - to detect only those polygons in the scene, that may collide with the moving object/camera in current period of time.
I.e. lets say i have 5000 polygons in my scene, detecting collision against each and everyone of them will eat my CPU alive.

From what I understand for this purpose Partition3d and Octree classes could be used to navigate and “cut” the portion of the scene around camera/object. I just don’t know how to this navigation. smile

   

Avatar
Alejandro Santander, Administrator
Posted: 15 September 2011 09:01 PM   Total Posts: 414   [ # 6 ]

You don’t have to test agains each polygon, you do against each object. For example you could test the position of the camera against the bounding box of a sphere =)

I can’t say no to you asking about Partition3D and Octree, I do not know about them.

   

Fossor, Newbie
Posted: 16 September 2011 11:06 AM   Total Posts: 21   [ # 7 ]

Still, when you have object with a multiple polygons, for example game map that is a big complex room/tunnel it needs to be partitioned.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X