Sign in to follow this  
riekhof

Extending lesson 10

Recommended Posts

Wanted: Hint on how to make lesson 10 stop running thru walls. I've been hacking on lesson 10 for a while now. I'm a newb, but I've managed to add strafing and get it to use different textures for the floor, walls, and ceiling. My next goal is to make it so you can't run through walls, but not sure how to go about this. I looked at lesson 30, but its over my head and doesn't really look like it deals with camera to object collisions. Are there any lessons or tutorials around that would help me on this? Also, at the end of the article the author said he'd be posting another tutorial on this. Is that next tutorial available anywhere?

Share this post


Link to post
Share on other sites
lesson 30 can be applied to this.
But i have to admit that true colition detection is tough as hell.

Using something like ODE could help, but colition detection is something all gameprogramers must learn so it just a matter of hard work and study study study.
Using google helps to.

the easiest an cheapest hack is to use lot's and lot's of if statements that basicly say.
If you move into this area then move back because it is forbidden to go here.

Share this post


Link to post
Share on other sites
tx for the info lc_overlord. The best thing I was able to google on this is:

http://www.morrowland.com/apron/article/gl/boundingbox/index.php

So I guess I'll try to come up with some clever data structure that keeps bounding box information on things kind of close to me.

Darrel

Share this post


Link to post
Share on other sites
Hey,

Its strange that you should post this, last nite i started working on some code for a tutorial to add collision detection to lesson 10. The collision will allow walking upstairs, sliding along walls etc.

Unfortunately I have my dissertation to work on at the mo so finding time to do it is difficult.

Strangly enough my dissertation is a 3D map editor, which will have an option to export to (you guessed it) lesson 10 format.

So watch this space :D

Luke.

Share this post


Link to post
Share on other sites
The best collision detection tutorials are on gametutorials.com.

Unfortunately, gametutorials.com recently underwent a change, and they now charge for their tutorials, which is awful. But still, the collision detection tutorials are top rate, and I know that I and alot of others learnt alot from these tutorials back when they were free. However, colision detection is complicated, even when using these tutorials, so I think there would be a chance that even after paying for these tutorials, you may not understand them, in which case you wasted good money.

The hack mentioned, whereby we make certain zones inaccessible, is certainly the best workaround I can think of without implementing real colision detection. Certainly for walking around a room, it would be easy to implement and effective.





Share this post


Link to post
Share on other sites
Guest Anonymous Poster
i made a function that i can put in x and z coordinates for the start and end of the wall. it makes you bounce off. it only works with one floor and doesn't do diagonals. it was something like this:

// make walls inpenetrable straight walls so far
void walls(float startx,float startz,float endx, float endz)
{ if (startx==endx){//if wall is parallell to z
if (xpos=startx-.2 && zpos>=startz && zpos=startx && zpos>=startz && zpos=startz && zpos=startx && xpos=startz-.2 && zpos=startx && xpos<=endx){ zpos=startz-.2;}
}

then you can put in coordinates. make sure you keep the starting coordinate the lesser value and your set. i haven't got to collision detection so thats all i have.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this