• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Made a New Collision System

Status
Not open for further replies.
I'm not sure if I should continue pursuing this idea. Initially I was going to do it with a region but that didn't work then I tried a point and that also did not work. However, using an invulnerable unseen dummy unit and having an event for it does work! Still there are limitations to this and I'm not sure if it's actually better than my previous system which was based on detecting when a unit is "damaged" by a specific effect that in reality causes no damage to the unit. Everything I want to do on collide will have to be written in here, for now I just have it show me a message saying that collision occurred.

JASS:
// =================================================================================================
//                                  HOW TO USE THE COLLIDER SYSTEM
// The value collide_radius is set to by default is the maximum search area.
// Set the position of collide_point then set the position of collide_unit to that point, the script
// will then detect all units in the default search area of collide_radius, and you can filter out
// ones if you want a smaller search area then the maximum, by determining the distance between the
// collide point and the unit, and you can probably do a rectangle collide too by comparing
// coordinates to see how far apart they are. Btw, registering a similar event using a point or
// region doesn't work, since the event doesn't know afterwards if you've moved the point or region
// or changed any other attributes with it.
//
// =================================================================================================

point   collide_point   = Point(0,0);
unit    collide_unit    = UnitGroupUnit(UnitCreate(1, Collider, c_unitCreateIgnorePlacement, 0, collide_point, 0.0), 1);
fixed   collide_radius  = 3.0;

bool SimAnt_CollisionSystem_Func (bool testConds, bool runActions) {
    DebugMsg("Collision Detected");
    return true;
}

//--------------------------------------------------------------------------------------------------
void SimAnt_CollisionSystem_Init () {
    TriggerAddEventUnitRange(gt_CollisionSystem, null, collide_unit, collide_radius, true);
}
 
Status
Not open for further replies.
Top