Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Collision detection and walking around environment


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 newtechnology   Members   -  Reputation: 783

Like
0Likes
Like

Posted 14 April 2014 - 02:32 AM

Hey, I want to add physics and collision detection in my game. At the moment I'm on the subject 'Collision detection' and I need some suggestions. I use XNACollision.cpp/.h from the Direct3D SDK for intersection tests. I need some help, how should I do to test collision between two AABBs and two spheres? I mean should I transform AABB/Sphere to World Space (but that result's into a fatter box) or should I do collision detection in local space of a object? (there are two boxes of two different models, both have their own local space. Should I transform box0 into local space of box1 and do collision detection there? or should I transform box1 into local space of box0 to do collision detection there?). Should I use physics engine for collision? if yes, then which one and what are the basics for becoming familiar with that physics engine?

 

The last question I put is 'How to walk around environment'? All games have buildings, houses, terrain etc. How they manage to get height of all those objects/environment to walk on it? Should I do ray-casting? (I already have a getHeight(x,z) function in my terrain class but what should I do if a house is on the terrain and I want my player to walk on the stairs and then go to terrace?) 


Edited by newtechnology, 14 April 2014 - 02:34 AM.


Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 7801

Like
2Likes
Like

Posted 14 April 2014 - 04:04 AM


Should I use physics engine for collision?

Yes !

 


if yes, then which one

This depends on a lot of factors. Most engines already come with a physics engine on board. Physx is popular for AAA titles. I personally prefer bullet (free, eg included in blender). Start with downloading the SDK and play around with some demos.



#3 xDarkShadowKnightx   Members   -  Reputation: 414

Like
0Likes
Like

Posted 14 April 2014 - 10:51 AM

I also suggest you use Bullet, its fast, has a simple API and is pretty easy to set up. Its also free, which may be good if your on a tight budget. Feel free to PM me if you need some help implementing it into your engine/game!



#4 newtechnology   Members   -  Reputation: 783

Like
0Likes
Like

Posted 18 April 2014 - 06:21 AM

Ok I will try to use physics engine but how to walk around environment? ray-casting to get height? or optimized ray-casting (divide mesh into octree to only test nearest triangles.) 

How do professionals do it? (Walking around buildings, floor, stairs, etc.)



#5 moldyviolinist   Members   -  Reputation: 192

Like
0Likes
Like

Posted 18 April 2014 - 10:30 AM

I think ray-casting is probably the best way to do collision detection with terrain or ground meshes. Bullet has a built-in ray testing function (a member of the btCollisionWorld) that should be quite optimized.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS