Linear velocity
jhaas
Member Posts: 233
Hi all!
I'm working with a game that involves ball movement. Every time the ball stops moving I need to set up the game to again launch the ball. I have rules to check for the absolute value of the linear movement on both the x and y axis. When the absolute value is = zero I want to relaunch the ball. My issue is this doesn't work consistently. Is there an issue with reading the linear velocity of actors or is there a different tried and true method I'm over looking? I've also tried to fire the rule when the velocity is less than 12 on both the x and y axis to allow a little room for error. Same results. If I play the game long enough the rule eventually fails to fire.
Thanks
I'm working with a game that involves ball movement. Every time the ball stops moving I need to set up the game to again launch the ball. I have rules to check for the absolute value of the linear movement on both the x and y axis. When the absolute value is = zero I want to relaunch the ball. My issue is this doesn't work consistently. Is there an issue with reading the linear velocity of actors or is there a different tried and true method I'm over looking? I've also tried to fire the rule when the velocity is less than 12 on both the x and y axis to allow a little room for error. Same results. If I play the game long enough the rule eventually fails to fire.
Thanks
Comments
I made an actor with an attribute called minSpeed and gave it a value of 20.
Then Made a rule that checks if the attrib minSpeed is > magnitude(linearVelocity.X,linearVelocity.Y)
When that is true I gave it a Change Velocity to start it up again.
I also have a Display Text to show that same magnitude.
In your case, you could give it a Display Text of abs(linearVelocity.X)+abs(linearVelocity.Y) to see if you get a number larger than 12 or 24 to see if your rule is truely not working.
Checking if the absolute value = 0 doesn't really do anything. Now if you had a floor(value) = 0, that might kick off some rules more often.