HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[SEE/vJASS] What am I doing wrong?

09-22-2008, 07:45 PM#1
Zandose
Hi, this is a question about the SEE system. I'm trying to just get a simple collision working for two units, but without success so far. What am I doing wrong?

SEE: http://www.wc3campaigns.net/showthread.php?t=98089

Collapse JASS:
library SEEunits requires SEEentityData

struct default extends entityData
    real radius         = 200.0
    real mass           = 100.0
    boolean bounceable  = true
    boolean collideable = true
endstruct

public function InitTrig takes nothing returns nothing
    call entity.createFromUnit(default.create(), CreateUnit(Player(0), 'H001', 0.0, 0.0, 0.0) )
    call entity.createFromUnit(default.create(), CreateUnit(Player(0), 'H001', 10.0, 0.0, 0.0) )
endfunction

endlibrary
09-23-2008, 01:36 PM#2
Alexander244
It doesn't seem to work when the objects are not being moved by the system (just following normal move orders).

Adding something like these three methods should give you the desired results:
Collapse JASS:
    method onOrder takes entity e returns nothing
        if GetIssuedOrderId() == OrderId("stop") or GetIssuedOrderId() == OrderId("holdposition") then
            call e.setVelocity(0., 0., 0.)
            call e.addGravity(1.)
        endif
    endmethod

    method onPointOrder takes entity e returns nothing
        call e.projectToPointSpeed(GetOrderPointX(), GetOrderPointY(), 0., 250.)
        call e.addGravity(1.)
    endmethod

    method onTargetOrder takes entity e returns nothing
        local widget w = GetOrderTarget()
        call e.projectToPointSpeed(GetWidgetX(w), GetWidgetY(w), 0., 250.)
        call e.addGravity(1.)
        set w = null
    endmethod

(There may be a better way to do it.)