Hey guys, I'm trying to set an instance variable called "FallSeconds" on each instance of an object based on it's velocity at it's angle.
Img:
I am using this formula to calculate the velocity at an angle: cos(ANGLE)*OBJECT.physics.velocityX + sin(ANGLE)*OBJECT.physics.velocityY (Thanks to R0J0hound for the formula)
Then if it's >50, every 0.1 sec I add 0.1 to the "FallSeconds" var of that specific object
If it's <50 I set it once to 0.
(I need the FallSeconds var to check if the object fell too much and destroy it)
My problem is that instead of checking for each object's velocity and adding only to that object's variable, it picks only one object to check the velocity and sets all other object's variable according to that velocity. (i checked this with the "cursor is over object" event)
I have tried adding a "Pick all OBJECT" event, as well as leaving it empty, but it had no effect, and when I added a "For Each OBJECT" event, it would only work on 1 object and the others would not change...
So, do you guys know what I'm doing wrong?