Page 1 of 1

Quads & Collisions

Posted: Mon May 16, 2011 10:13 am
by worldmodeler
Hello, dev community! =)

I'm working on the example "lesson10b" of "examples/3D/nehe", I've modified world.txt, and created some quads, but now I want to add collision events to these quads. How can I do that? (I'm a beginner^^)

Thanks in advance for your help :)

Re: Quads & Collisions

Posted: Tue May 17, 2011 1:57 pm
by lazyprogramer
Do you mean when the player (in this case it's just the camera) collides with the quads...?

Re: Quads & Collisions

Posted: Tue May 17, 2011 3:08 pm
by worldmodeler
Yes =)

Re: Quads & Collisions

Posted: Tue May 17, 2011 5:38 pm
by elhobbs
this is not really a libnds questions. there are numerous articles to be found on the web that describe different approaches to collision detection. take a look around on the web and then come back if you have specific problems implementing something on the ds.

Re: Quads & Collisions

Posted: Tue May 17, 2011 8:15 pm
by lazyprogramer
Well I think you could compare the coordinates of the polygons of the quads with the player's coordinates!
For the events you can add some bools which disable walking arround. You also can code a hitbox for the player!
Do you need the source or do you want to try it yourself?

Re: Quads & Collisions

Posted: Tue May 17, 2011 10:18 pm
by worldmodeler
The source will be helpful, thanks =D I've tried a lot of things but nothing works correctly :(

Re: Quads & Collisions

Posted: Wed May 18, 2011 1:14 am
by WinterMute
Show us what you've tried.

You'll learn much more from trying things and having others point out where you went wrong than from just using someone else's code.

Re: Quads & Collisions

Posted: Wed May 18, 2011 8:09 am
by relminator
Learn:

Cross Product (Needed for fast "inside" triangle tests )
Dot Product + Plane Equation (Needed for quad/tri to point collisions modelling)

Re: Quads & Collisions

Posted: Wed May 18, 2011 1:29 pm
by lazyprogramer
Show us what you've tried.
Good idea WinterMute!
Just show us wath you 've tried then we will help you, okay?