Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Bikecollision

Author
Message
Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 8th Mar 2008 18:11
im making a game and if the two bikes collide then i want the players bike to bounce of a little bit in the direction that it should e.g. if the players bike hits the side of the computer controled one i would like it to bounce away from the side of the bike and if it hits the back on the computer contrplled bike then i want it to bounce back wards.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 8th Mar 2008 19:14 Edited at: 8th Mar 2008 19:14
This is way too complicated a question to answer here and if a code example was posted, are your programming skills advanced enough to understand it?

You only joined less than a month ago and based on all your previous posts I have to suggest that you are maybe trying to tackle more advanced things before learning the basics.

But, if you insist on continuing, take a look at Sparky's collision DLL as it will give you the points of contact and bounce vectors for when two objects collide. You can use this to calculate how to make the objects react.

TDK_Man

Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 8th Mar 2008 21:20
Ok, i might understand it, i've been programing on db for a year and a bit now, it's just i only joined the forum 2 months ago, ty ne way
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 12th Mar 2008 01:16
I don't think this is too hard.
if you are moving the bike with the controls, you are specifying the direction it's moving. If there is a collision simply reverse this direction. How the bike acts after collision and how far it bounces etc is a matter of testing to see what is realistic.

If you are using MOVE OBJECT you've got some work to do

Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 22nd Apr 2008 22:20
Quote: "if you are moving the bike with the controls, you are specifying the direction it's moving. If there is a collision simply reverse this direction. How the bike acts after collision and how far it bounces etc is a matter of testing to see what is realistic.
"


thing is though. if one bike hits the other on the side. the second bike moves sideways, and visa versa so you have to work out which bike is hitting the others side and work out which side.

if they hit side to side the they both move side ways. but you have to work out which is on the left and which the right.

if they hit head on then they both go backwards.

and if one hits the other from behind one goes forward the other backwards.you have to work out which is hitting which.

so really you have to decide which of the different possibilities is occuring when they colide.

thanks.

codeeater.

p.s. sorry for being so long to reply
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 24th Apr 2008 00:09 Edited at: 24th Apr 2008 00:11
Check the angle the bikes are facing (the direction each is traveling). That will help determine the collision.

You can also place four invisible "bumpers" around the bike ( NSWE) that can help you determine where on the bike the collision occurs.

You can use vector addition and subtraction to calculate an offset to the positions after the collision(s).

Enjoy your day.
Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 24th Apr 2008 19:36 Edited at: 24th Apr 2008 22:48
i had used bumpers but they seemed to not manage to keep up and they lag behind the bike.
im not quite sure how i would work it out using an angle.

[edit]
can i have more than one collision box per object? i presuming that i cannot had a look around he forums:

before when i did bumpers i did the bike position +? if this time i glue them to limb and i had one on the front wheel, the back wheel and the main body, could i have a collision box for each object glued to a limb.

from there i could work out the combinations.
e.g. if its the two front wheels hitting then they must be hitting head on. if both bodies hit then they must be hitting sides

code eater

thanks

Login to post a reply

Server time is: 2025-06-07 12:48:30
Your offset time is: 2025-06-07 12:48:30