"move to" at high speeds, often not stopping
Sparkyidr
Member Posts: 2,033
Just been messing around with an actor that controls the camera, and some move to behaviours that happen when an attribute is set.
I have a scene, 3 screens wide, and have an actor sitting in the middle of the middle screen.
I then have 2 buttons for left, and right, when I press left, it sets an attribute "game.started" to 1, if I click the right, it sets it to 2. I then have an exit button on each screen, which sets the attribute to 0.
When it's 0, I tell the actor to move to the centre of the middle scrren, 1 for the left, and 2 for the right
When I have the move to speed set reletively low, like 100-300, it seems to work fine.
If I set it to 500, it starts to get a bit flakey, sometimes just not stopping, but maybe 70% working ok.
If I get silly and set the speed to something like 2000, it pretty much just fails every time (
I have tried adding to the rules something like :
when self position x = 140 set linear x to 0....but didn't help.
Anyone tried something similar?
I have a scene, 3 screens wide, and have an actor sitting in the middle of the middle screen.
I then have 2 buttons for left, and right, when I press left, it sets an attribute "game.started" to 1, if I click the right, it sets it to 2. I then have an exit button on each screen, which sets the attribute to 0.
When it's 0, I tell the actor to move to the centre of the middle scrren, 1 for the left, and 2 for the right
When I have the move to speed set reletively low, like 100-300, it seems to work fine.
If I set it to 500, it starts to get a bit flakey, sometimes just not stopping, but maybe 70% working ok.
If I get silly and set the speed to something like 2000, it pretty much just fails every time (
I have tried adding to the rules something like :
when self position x = 140 set linear x to 0....but didn't help.
Anyone tried something similar?
Comments
Is there a target Actor you can test for?
pretty frustrating
yet if you tell it to move to floor(x) and floor(y) it should have better odds of hitting the target.
i have messed with this some and this is the best reasoning i could come up with.
basically though the moveTo behavior is broken and you shouldn't need to hack it like this.
btw, no guarantee this will work.
you are right Orbz, it's defo a some kind of timing issue.
on a related note, it seems to be working "most/all" of the time with the speed set to the default 300!
)
Will give the floor x floor y thing a go tomorrow. Thanks for that.
Here is what happens :
The camera move actor gets to x=140...that's where I want it to stop.
So I say When self.position.x <or=140 set linear velocity to 0
In theory, if it overshoots the 140 x value, it should stop
When I set the move to speed to say 1000, what actually happens, is at or less than 140, it sets the x velocity to MINUS 1000, so the actor shoots off in the opposite direction.
Seems like a fairly unexpected result.
Tangently related, if you want the overall velocity/speed of the actor, use the velocity X and velocity Y values of an actor for the "x" and "y" values of the "magnitude(x,y)" function.