|
-
Sep 11th, 2004, 10:11 AM
#1
Thread Starter
New Member
collision detection help
Haven't done much math in VB.NET but here goes
I'm making an educational lunar lander game with addition/subtraction and stuff. I can handle the math with that, but there's some collision detection that requires some math.
The terrain at the bottom of the screen is made up with speed in mind. The resolution of the terrain is about 400heighth by 600width. Instead of having an array with 600 elements I have the terrain broken up into segments which is random which could be anything between 30-70. So 20-70 points are created and then I create line between each of the 20-70 points. As this increases the app in speed, it also makes the collision detection harder.
Say I have two points 300,5 and 310,10
this is kinda like one of those graphic math problems.
I need to make a method that will tell me of the heighth of all of those points in between.
I have 5 which is equal to 300
I have 10 which is equal to 310
I need to find the values of 6-9
This is quite simple but my mind is just blank for some reason. All help is appreciated in advance. Thank you.
-Phil
Microsoft Certified Application Developer
Microsoft Certified Professional
COMPTia Network+
-
Sep 11th, 2004, 01:57 PM
#2
Thread Starter
New Member
well i think I figured it all out, but for anyone wanting to implement something like this, you will need to know a couple formulas.
The slope formula
and the y-intercept formula (not sure if thats the technical term)
but since you are looking for b
please let me know if I screwed any of this up.
once you have both formulas, you can determine the heighth of x by using y=mx+b
-Phil
Microsoft Certified Application Developer
Microsoft Certified Professional
COMPTia Network+
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|