Bullets/Barriers
Author |
Message |
chaos
|
Posted: Fri Dec 31, 2010 2:15 pm Post subject: Bullets/Barriers |
|
|
[How do u get bullets to work with barriers? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
|
|
|
|
TokenHerbz
|
Posted: Fri Dec 31, 2010 2:31 pm Post subject: RE:Bullets/Barriers |
|
|
if bullet position is at barrier, stop bullet else bullet keeps movies. |
|
|
|
|
|
TerranceN
|
Posted: Fri Dec 31, 2010 3:11 pm Post subject: RE:Bullets/Barriers |
|
|
@TokenHerbz: The only problem with that is bullets tend to move really fast.
The best collision method I have found for things that are really small and move really fast, has been linear collision. Your barrier is represented by a line, and the bullets path is represented by a line from where it was last update call, to where it is now. Then you can use grade 9 math to calculate where the lines crossed. If that point is within the rectangle defined by the barrier's line, and is within the rectangle defined by the bullet's path, collision occurred, and you even have the point it happened too.
A much simpler way is rectangular collision, you can find a tutorial here. This method might fail if your bullet is going too fast, but will usually work just fine. |
|
|
|
|
|
TokenHerbz
|
Posted: Fri Dec 31, 2010 6:19 pm Post subject: RE:Bullets/Barriers |
|
|
you can easily do a check to incorporate any speed jump.. rectangle collision isn't the best especially if your not even using them, but should be easy enough to start with. |
|
|
|
|
|
|
|