How to destroy an object when it stops moving?

danayeldanayel Member Posts: 25
edited November -1 in Working with GS (Mac)
I am trying to destroy an object when it stops moving, but I can't work out how to detect if the current object is moving or not, other than to constrain it's x and y to a global x and y and check every second or so if the x and y have changed (compare to x2 and y2, then update x2/y2 if changed).

I tried linear velocity and angular velocity, but neither seemed to work

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    Rule
    When ALL conditions are valid:
    self.Motion.Linear.X < 0.05
    self.Motion.Linear.Y < 0.05
    -----Destroy Actor

    The above SHOULD work. You don't need Constrains or Timers. Let me know if it doesn't. You can monkey with the 0.05, that's just in case it doesn't get all the way to 0.
  • danayeldanayel Member Posts: 25
    I tried that but it just blew up instantly all the time.

    It easiest to try this with the cannon template.
  • danayeldanayel Member Posts: 25
    gah I am an idiot. The moment it is spawned it has a velocity of 0,0

    Once I put a 1 second delay on the rule (after 1 sec timer) it worked fine.

    Then another 1 sec delay before destruction and it works great. Cheers fmp.
Sign In or Register to comment.