Constrain Variable not working until key is lifted
Hello, I'm creating a program that is using left and right arrow keys to accelerate angular velocity of an actor. I have left and right key rules which modifies a variable I created for angular velocity. I know that actors already have this variable, but due to a bug described here http://forums.gamesalad.com/discussion/17772/angular-velocity-bug I use a separate tracking variable which is modified in these rules, and then outside the rules I am constraining the official Angular Velocity of the actor to the tracking variable I created.
The issue is that the actual velocity is only updated when I lift the key, so if I hold the key down it still only increases by one increment. Is this just a feature of a key press (I thought the code inside the rules were supposed to happen while it's down, not just once per press)? Or is there something I'm missing?
Let me know if you need more info. Thanks!
Comments
That bug must have been squashed a long time ago, it's not something I've personally come across in the last few years (the post is almost 4 years old) and I do a lot of that kind of thing (incrementally increasing angular velocity), maybe it's only a PC thing ?
I guess it could be just a PC thing. I'll look into I it further. So you have Change Variable rules setting Angular Velocity to itself plus or minus an increment? Like:
angular.velocity = angular.velocity + 10
Also, Any ideas on the constrain variable thing? That's not related to the bug and I think it should be working properly the way I have it. If I could get this fixed it would be a good workaround for the bug, assuming it still exists.
Thanks!
I found the issue here. I needed to put the variable updates (both constrain and change attribute behaviors) within a timer within the Key event for them to continue happening while the key is down. Otherwise they only happen once per key press.
Still not sure about the Angular Velocity attribute though.