Are there any good articles on shooting projectiles and doing collision detection? I'm trying to make a top-down shooter where your mouse is your aiming reticle and you firing where ever you click, even if nothing is there.
I saw that the guy who posted his 3rd person shooter engine could do this, but I have no idea how to edit it so I can just get the collision detection out of it. Any help?
Do you want the location you click to instantly be hit, or do you want a missile to be launched from your unit?
If the latter, try creating an ability that can target a point or a unit.
Do you want the projectile to always travel the same distance (so if you aim closer, it travels further, but if you aim past the max range, it dies before it gets to the target).
Assuming you do.
Have this ability first run a persistent effect. This persistent effect should have a period count of however many projectiles you'd like to launch per click. The periodic effect should be a launch missile effect. To get the projectile to always travel the same distance, give the y value of the periodic offset your range. Set the target location to the source unit.
To detect collision: Make a behavior of type buff. Give it a duration of however long you'd like the projectile to remain flying before it times out. Give it a period duration of something small, such as .1 .
Have the periodic effect be a search effect. Make sure to exclude the projectile. Have the search effect apply a the damage, as well as a kill effect to the projectile itself. Do this by combining them in a set effect.
Give this behavior to your unit.
If you care about which specific unit gets kill credit, have the launching unit apply the behavior with a search effect upon launching to the projectile.
This is a rough explanation that should give you an idea on what to do. Feel free to ask for clarification on specific points.
Thanks a lot. You really nailed the mechanics I'm looking for. It'll take me some time before I really know what exactly I will need help with, but this is a great start. I understand the logic behind doing this now which is what I was aiming for. I will revive this thread when I get around to figuring out the finer details of the stuff. Thank you very much for the awesome answer and quick response tho =).
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Are there any good articles on shooting projectiles and doing collision detection? I'm trying to make a top-down shooter where your mouse is your aiming reticle and you firing where ever you click, even if nothing is there.
I saw that the guy who posted his 3rd person shooter engine could do this, but I have no idea how to edit it so I can just get the collision detection out of it. Any help?
@Darknuke1987:
Do you want the location you click to instantly be hit, or do you want a missile to be launched from your unit?
If the latter, try creating an ability that can target a point or a unit.
Do you want the projectile to always travel the same distance (so if you aim closer, it travels further, but if you aim past the max range, it dies before it gets to the target).
Assuming you do.
Have this ability first run a persistent effect. This persistent effect should have a period count of however many projectiles you'd like to launch per click. The periodic effect should be a launch missile effect. To get the projectile to always travel the same distance, give the y value of the periodic offset your range. Set the target location to the source unit.
To detect collision: Make a behavior of type buff. Give it a duration of however long you'd like the projectile to remain flying before it times out. Give it a period duration of something small, such as .1 .
Have the periodic effect be a search effect. Make sure to exclude the projectile. Have the search effect apply a the damage, as well as a kill effect to the projectile itself. Do this by combining them in a set effect.
Give this behavior to your unit.
If you care about which specific unit gets kill credit, have the launching unit apply the behavior with a search effect upon launching to the projectile.
This is a rough explanation that should give you an idea on what to do. Feel free to ask for clarification on specific points.
@Vexal: Go
Thanks a lot. You really nailed the mechanics I'm looking for. It'll take me some time before I really know what exactly I will need help with, but this is a great start. I understand the logic behind doing this now which is what I was aiming for. I will revive this thread when I get around to figuring out the finer details of the stuff. Thank you very much for the awesome answer and quick response tho =).