How to destroy an object when it stops moving?
danayel
Member Posts: 25
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
I tried linear velocity and angular velocity, but neither seemed to work
Comments
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.
It easiest to try this with the cannon template.
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.