• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

A way to do efficient collisions for projectiles(for a 2d projectile system)

Status
Not open for further replies.
Level 7
Joined
Apr 1, 2010
Messages
289
here is a efficient way to do collision for projectiles that i just thought of.
There are various ways to create a collision detection system, the big problem is lag here is relativity a lagless way,

when you create your dummies in the Object editor, give them a melee attack and then set the attack range between 10-90 the larger the range the bigger the collision of the projectile will be.

You will need to create an ability based off of Root and give it to the projectile. what this will do is make the projectile act like a building, the unit will not give chase to units, but it will still have flying height.

then just create a trigger like the following
  • Collisions
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Projectile
    • Actions
      • Unit - Cause (Attacking) to damage (Triggering unit), dealing 500.00 damage of attack type Spells and damage type Normal
      • Unit - Kill (Attacking unit)
the trigger for dealing the damage wouldn't be exactly like this, you would have the unit that spawned the projectile damage the target and maybe recycle the projectile.

if you are using a system where the projectiles collide with each other, first set their target type to something no other unit can attack and then enable the projectiles to attack other projectiles.

Also you will need to add
  • Custom script: call UnitRemoveAbillity(udg_dummy, 'Aloc')
to your dummy creation trigger this will make the unit behave like unit that has locast in the fact that it cannot be selected but unlike it in the fact that it is not invulnerable.


the best way would be to use a damage detection sys, heal the damage dealt by the projectile and compare the height of the units (it would be GetLocationZ(udg_P) + Unit Flying height(udg_dummy) and if the absolute value of the difference between the two heights is >= 5 then have it do its effect.


edit: feel free to comment.
 
Last edited:
Level 16
Joined
Aug 20, 2009
Messages
1,554
how are you going to move the unit? and the unit can't attack while moving,

maybe using phoenix fire is better than using attack.
"set unit XY every 0.03 (while it shoots phoenix fire) won't be bad."
"When unit takes damage"
"there is phoenix fire buff with 0.01sec duration (its checkable, but can't be seen, like triggering autocast arrows."
"cause damage source to deal x damage,and all the effects that you need, and recycle it."
 
Status
Not open for further replies.
Top