Delgine 3D Tools & Content DeleD Community Edition
Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Collision Dectection for DMF

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD User Game Projects
View previous topic :: View next topic  
Author Message
banshee777
Member


Joined: 10 Feb 2005
Posts: 37

PostPosted: Thu Feb 17, 2005 1:35 am    Post subject: Collision Dectection for DMF Reply with quote

Hello people

Any advice on how to get collision dectection on the DMF format system?
any pointer's? I've got it rendering, but now i want to be able to fall on the map and walk around.
Back to top
View user's profile Send private message
Mr.Fletcher
DeleD PRO user


Joined: 07 Aug 2004
Posts: 1772
Location: Germany

PostPosted: Thu Feb 17, 2005 9:18 am    Post subject: Reply with quote

Try implementing Newton Game Dynamics! It may be a bit difficult, but there, you've got a great collision detection and the right physical behaviour. I don't know if it's still like this, but when i tried it, there was a problem with the character controller, means that it's quite difficult to build in a body representing your player (that's easy, but to control it correctly, so that the figure can jump and climb stairs etc. is the hard part). If that doesn't work, you might look for some tutorials on collision detection in the internet.

//edit
With NGD, you can also easily create doors and stuff, so it's really worth having a look at it!
_________________
Behold! The DeleD Wiki! Please help us expanding it Smile
DeleD on IRC
Back to top
View user's profile Send private message
Daaark
DeleD PRO user


Joined: 01 Sep 2004
Posts: 2696
Location: Ottawa, Canada

PostPosted: Thu Feb 17, 2005 9:26 am    Post subject: Reply with quote

Try gamedev.net and flipcode.com... maybe gametutorials.com and look for collision articles. There is nothign special about the DMF... it's just a list of vertices and triangles like everything else.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Paul-Jan
Site Admin


Joined: 08 Aug 2004
Posts: 3066
Location: Lage Zwaluwe

PostPosted: Thu Feb 17, 2005 9:35 am    Post subject: Reply with quote

I agree with Mr Fletcher: if your math skills are not too strong, like you stated, using an existing engine would be a Good Thing (tm). Collision detection and response is not exactly easy.

The problem is not .dmf-file specific, it is a very generic "collision detection versus triangle soup" problem. "Triangle soup" refers to the fact that you don't have a spatial structure like an octree or .bsp available.

If you want to really do things yourself, a fairly good place to start reading would be:

http://www.gamedev.net/reference/articles/article1026.asp

It gives a nice explanation for sliding sphere (or better: ellipsoid) collision. Which is what you want to do: you want to 'wrap' your character inside a collision ellipsoid and test it versus the world.

Once you've got that working right, it is time to look at performance. For bigger, non trivial maps you will probably find that to keep performance up, you'll need to put your polygon data in some kind of spatial structure. If bsp is over your head, try loading (a simplified version of) your map into an octree. Not quite as hard, and it tends to work pretty well.
Back to top
View user's profile Send private message Visit poster's website
banshee777
Member


Joined: 10 Feb 2005
Posts: 37

PostPosted: Thu Feb 17, 2005 10:42 am    Post subject: Reply with quote

I've did collision's before. But it was only box's collison. Could walk up stairs, but couldn't walk down a box that was angled. That way was just hopeless for games unless, the whole map was made out of box's and never rotated.

This is going to be hard to take on. I've read a few tutorials but found it hard to understand.

1. I think i need a vector
2. I need to check the normal of planes

I think it works like this, check if vector is hiting plane, check distance, move, check distance, stop..move vector, check plane, move.

I think that how it works, then you add gravity, mouse look and if should be like normal 3d shooter.
Back to top
View user's profile Send private message
Paul-Jan
Site Admin


Joined: 08 Aug 2004
Posts: 3066
Location: Lage Zwaluwe

PostPosted: Thu Feb 17, 2005 2:36 pm    Post subject: Reply with quote

If you are saying what I think you are saying, I think you are right Smile
Back to top
View user's profile Send private message Visit poster's website
banshee777
Member


Joined: 10 Feb 2005
Posts: 37

PostPosted: Thu Feb 17, 2005 8:27 pm    Post subject: Reply with quote

Paul-Jan wrote:
If you are saying what I think you are saying, I think you are right Smile


Mabe just a little right...
Back to top
View user's profile Send private message
mog
Member


Joined: 22 Apr 2005
Posts: 6

PostPosted: Fri Apr 22, 2005 12:58 am    Post subject: Reply with quote

i have a collision code who rox with deled, it was made by kensuper

Code:
`***************************
`.X Model sliding collision
`By Kensupen and Lokidecat


toldx#=camera position x(1)
toldz#=camera position z(1)
tcx#=camera position x(1)
tcy#=camera position y(1)
tcz#=camera position z(1)
tca#=camera angle y(1)
`The main sliding collision code
gosub _tcollision
`My code to walk up a ramp if the angle isn't too steep
gosub _tramp
_tramp:
`get positions again
tcx#=camera position x(1)
tcz#=camera position z(1)
`Get your old height
toldht#=camera position y(1)
`calc new height using intersect object from the old height down charht# units
tsub#=intersect object(1,tcx#,toldht#,tcz#,tcx#,toldht#-(charht#*2),tcz#)
tht#=(toldht#+charht#)-tsub#
if tsub#=0 then tht#=tcharht#
`do some gravity
tgrav#=tgrav#-0.25
`if you are going up a ramp
if toldht#+tgrav#<ht#
   tgrav#=0.0
   position camera 1,tcx#,tht#,tcz#
else
`if you are falling
   tht#=toldht#+tgrav#
   position camera 1,tcx#,tht#,tcz#
endif
return

_tcollision:
`make 72 collision points. You can use more or less, but this number seems to work good.
`These are vectors every 5 degrees from the camera position out.
`They return the distance when they hit an object
for x=0 to checks-1
   tchx#=newxvalue(tcx#,x*angwidth,100)
   tchz#=newzvalue(tcz#,x*angwidth,100)
   tang#(x,1)=intersect object(1,tcx#,tcy#,tcz#,tchx#,tcy#,tchz#)
   if tang#(x,1)=0 then tang#(x,1)=999999
   tang#(x,2)=x*angwidth
   tsort#(x,1)=tang#(x,1)
   tsort#(x,2)=tang#(x,2)
next x

`sort the array to find the closest object and it's degrees
for x=0 to checks-2
for y=x+1 to checks-1
   if tang#(x,1)>atng#(y,1)
      ttemp#=tang#(x,1)
      ttemp2#=tang#(x,2)
      tang#(x,1)=tang#(y,1)
      tang#(x,2)=tang#(y,2)
      tang#(y,1)=ttemp#
      tang#(y,2)=ttemp2#
   endif
next x
next y
`find +-90 degrees from the closest one for when you walk into a corner so it doesn't shake
tprev=wrapvalue(tang#(0,2)-90)/angwidth
tnxt=wrapvalue(tang#(0,2)+90)/angwidth
tnewd#=radius#-tang#(0,1)
tnewa#=wrapvalue(tang#(0,2)-180)
tnewd1#=radius#-tsort#(tprev,1)
tnewa1#=wrapvalue(tsort#(tprev,2)-180)
tnewd2#=radius#-tsort#(tnxt,1)
tnewa2#=wrapvalue(tsort#(tnxt,2)-180)
`if you are less than radius from a wall, push you out to 20 from it
if ang#(0,1)<radius# and ang#(0,1)>0.0
   trepx#=newxvalue(tcx#,tnewa#,tnewd#)
   repz#=newzvalue(tcz#,tnewa#,tnewd#)
   position camera 1,trepx#,tcy#,trepz#
endif
tcx#=camera position x(1)
tcz#=camera position z(1)
`this is if you are coming into a corner, this pushes you sideways
if tsort#(tprev,1)<radius# and tsort#(tprev,1)>0.0
   trepx1#=newxvalue(tcx#,tnewa1#,ntewd1#)
   trepz1#=newzvalue(tcz#,tnewa1#,tnewd1#)
   position camera 1,trepx1#,tcy#,trepz1#
endif
tcx#=camera position x(1)
tcz#=camera position z(1)
`and the other way. above is left, this is right
if tsort#(tnxt,1)<radius# and tsort#(tnxt,1)>0.0
   trepx2#=newxvalue(tcx#,tnewa2#,tnewd2#)
   trepz2#=newzvalue(tcz#,tnewa2#,tnewd2#)
   position camera 1,trepx2#,tcy#,trepz2#
endif
return

_________________
***please forgive my bad english***

www.whitechaos.tk
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
Signot
Member


Joined: 18 Feb 2005
Posts: 25
Location: Canada

PostPosted: Mon Jun 06, 2005 4:28 pm    Post subject: Reply with quote

If you feel up to the challenge of implementing your own collision system, then I suggest checking out a few of these sights.

http://www.fluidstudios.com This site has some code that the author supplies for implementing collision detection. The code is all templated and is quite easy to follow his example. The only problem was I couldnt' get it to compile under Visual Studio .NET 2003 The project was written in Visual Studio 6 (but I took that off a while ago Sad)

Another good site and one that I have implemented myself can be found at:
http://www.peroxide.dk/papers/collision/collision.pdf This PDF gives a very good description of what the algorithm is doing. I wouldn't recommend implementing this algorithm as its not mathematically correct (it won't work on corners and such..,) but, its great to get an idea of how the design works. Instead, the author has supplied some demos with updated code that produces much more stable results.

http://www.peroxide.dk/forums.shtml Check out the forums. I forgot where I found the sample code on his site, but I will host it on my site later today for everyone. The sample is great and is very stable. I am currently using it in my game.

Collision detection and response can be very tricky, and if you don't have the necessary math skills, I would suggest using a prebuilt engine or collision library. Most of the libraries I have looked at are very versatile and focus on providing realistic motion and response in a 3d world. They may require a little bit of learning at the start, but it can save you a lot of headaches in the future Smile

Good luck!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Guest






PostPosted: Fri Sep 23, 2005 12:14 am    Post subject: Confused Reply with quote

I have no idea of what is going on? Surprised)
Back to top
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD User Game Projects All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum