HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Collision

01-28-2005, 01:36 AM#1
TheGreatCheese
I previously posted on this topic a few weeks ago, i was wondering if there was a way to find the collision of a unit? Help would be rewarded
01-28-2005, 11:06 AM#2
iNfraNe
Quote:
Originally Posted by TheGreatCheese
I previously posted on this topic a few weeks ago, i was wondering if there was a way to find the collision of a unit? Help would be rewarded
hmm... well... There is a way, but it would be really ugly. What you could do is have a place on your map with pathable and nonpathable next to eachother and then create a unit at a pathable place (the closest pathable place to the non-pathable) and then check if his location is the same as the location you had put him on:
Code:
function IsLocPathableForUnit takes integer unitid, location where returns boolean
  local unit pathing
  local location checkpoint
  set pathing = CreateUnitAtLoc(Player(14), unitid, where, 0)
  set checkpoint = GetUnitLoc(pathing)
  if GetLocationX(checkpoint) == GetLocationX(where) and GetLocationY(checkpoint) == GetLocationY(where) then
    call RemoveUnit(pathing)
    call RemoveLocation(checkpoint)
    set pathing = null
    set checkpoint = null
    return true
  endif
  call RemoveUnit(pathing)
  call RemoveLocation(checkpoint)
  set pathing = null
  set checkpoint = null
  return false
endfunction 
if you know a little jass u might understand this and change it yourself. Anyway... the easiest way it to just put all in variables.
01-29-2005, 04:31 AM#3
TheGreatCheese
thanks alot that will work perfect
01-29-2005, 06:15 AM#4
curi
would a better way just be to make 2 units in the same (empty) place, and see how far apart they are, and divide by 2?
01-29-2005, 09:06 AM#5
iNfraNe
Quote:
Originally Posted by curi
would a better way just be to make 2 units in the same (empty) place, and see how far apart they are, and divide by 2?
true... true...