Skip to main content
GameDev.net gamedev.net
🔒 Locked

Passage detection

Started by NDraskovic Nov 30, 2011 at 11:40 AM 1 replies 3k views
Original Post
NDraskovic
NDraskovic
Hey

I have a simple program for now - 2 simple models displayed on the screen (I made both models using Wings3D) , first represents a road with 3 stations along its way and second is a "vehicle" going down this road. My question is how can I make the vehicle stop in front of each station (obviously without colliding with it). I was thinking of placing a boundedBox in front of each station, but the problem is positioning it (Q2: how can I get the length and width of the displayed model(s)). I never worked with boundingBoxes before so I tried to find some examples on-line and found Riemers tutorials, but they are unpractical because they are tied to the chapters before, and at this point I don't have time to go over all of them (particularly they use previously placed objects like buildings to place their boundingBoxes, which again gives me trouble with placing mine).

My goal is to get the "vehicle" to start from the beginning of the road (on users command) stop in front of each station (again wait for users input to continue) and when it reaches the end of the road to stop beside it.

At this point I have the first and the last part working fine, please help me make the rest work. I mentioned using boundingBoxes because it is the only collision detection method I know, but if you have any other method that you think will work better, it would be very welcome.
I postet this question at DirecX and XNA forum, but got 0 responses so far. Please help


Tnx
Promethium
Promethium
Is the vehicle user controlled or autonomous? If the user has no direct control over it and it just have to follow a path between the three stations I wouldn't bother making a complex "driving" model. Just manually place a spline along the road and have the vehicle follow the spline and stop at the right points. Like station one may be at position T = 3.5 on the spline, station two at T = 13.9, station three at T = 37. Then the vehicle will always behave correctly, you don't have to worry about imprecise simulation or numerical instability or anything.
NDraskovic
NDraskovic

Is the vehicle user controlled or autonomous? If the user has no direct control over it and it just have to follow a path between the three stations I wouldn't bother making a complex "driving" model. Just manually place a spline along the road and have the vehicle follow the spline and stop at the right points. Like station one may be at position T = 3.5 on the spline, station two at T = 13.9, station three at T = 37. Then the vehicle will always behave correctly, you don't have to worry about imprecise simulation or numerical instability or anything.


Actually the "vehicle" is not the object of control here, the stations are. User has only 2 controls available - trigger movement (binded to RightArrow, but that is unimportant) and reset (Space). My final goal is a bit complicated to explain - the "vehicle" should stop at a station and there get the info on where to go next (so in the end it's path could be i.e s1-s3-s2-s1-s3-end ). The path can't be hard coded into the program, it will be imported from a file created by another application (I'm thinking of using XML files, is there an easier solution?). Like I said, the only control that user has (for now) is to trigger the movement (regardless of direction) and when the vehicle reaches the end, to reset it and place it back to the start. His only "job" for now is to verify that the "vehicle" arrived to a station and trigger it's movement to the next one.


I've placed vehicle under quotes because this is not a race simulation ("vehicle" does not have properties like speed, acceleration or methods like steer, it just has a parameter that controls it's position on the "road"), but the "road-station" was the easiest way of describing the stage.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.