Trouble with Actors wiggling when they should be stationary
part12studios
Member Posts: 620
Hi everyone, I found this thread from almost a year ago http://forums.gamesalad.com/discussion/comment/358833#Comment_358833
The one solution suggested by a link doesn't work anymore @jamie_c
So seeing that this happened then and is still happening, surely there must be a way to address this. I've tried to the best of my knowledge all of the suggestions in that thread with no luck or change in behavior at all.
This is a really serious bug when dealing with numerous objects on screen all jiggling on their own uncontrollably. It is going to make it difficult to make this game as it should be when such basic bug occurs.
Thanks!
Caleb
The one solution suggested by a link doesn't work anymore @jamie_c
So seeing that this happened then and is still happening, surely there must be a way to address this. I've tried to the best of my knowledge all of the suggestions in that thread with no luck or change in behavior at all.
This is a really serious bug when dealing with numerous objects on screen all jiggling on their own uncontrollably. It is going to make it difficult to make this game as it should be when such basic bug occurs.
Thanks!
Caleb
Best Answers
-
RThurman Posts: 2,880@part12studios
The missing video from @jamie_c showed how to put these rules in the "otherwise" section of a collision rule:
Change Attribute:self.selfX To: self.Position.X
Constrain Attribute: self.Position.X To: selfX
Change Attribute: self.selfY To; self.Position.Y
Constrain Attribute: self.Position.Y To: selfY
But I don't particularly like using constrains (which can bog things down).
Another way to do it is to stop the linear velocity with a timer. (Because, for me, it seems that the linear velocity has a residual effect that does not get completely turned off before it moves on to the next behavior.) So I do something like:
Change Attribute: self.Linear Velocity.X To: 0
Change Attribute: self.Linear Velocity.Y To: 0
Timer ( For .1 seconds)
--Change Attribute: self.Linear Velocity.X To: 0
--Change Attribute: self.Linear Velocity.Y To: 0 -
ericzingeler Posts: 334@part12studios
FYI: I saw your other post and couldn't reply because it was a pro thread.
Try this:
Move behavior with:
Move Type: stacked
Speed: 0
You can throw this inside a rule when magnitude(motion.x,motion.y) is less than some number. -
ericzingeler Posts: 334@part12studios
Ok, I've done some digging around and I'm thinking it's related to the engine's drag function. Although it only appears to happen when more than 1 actor is in the scene.
Check out this project for a demo.
Inside the move actor there is a function that (once actor is under a specified speed) will gradually make the actor stop by using some basic drag math. Once the actor has stopped, the drag function quits.
-
ericzingeler Posts: 334Also wanted to point out why my second solution would be a better option. Using the move stacked although less work, can cause some unwanted behaviors.
For example:
You have an actor with a rule that when under a speed of 5, move (stacked) to 0.
Now let's say that actor is traveling perpendicular to a wall and collides with it, then bounces off heading in the exact opposite direction. In theory, at some point after the bounce the actor speed would be equal to zero, thus qualifying the move rule and interrupting the intended path from bouncing off the wall.
The second solution (if math is correct) would never interfere with the intended path, but always does its job of stopping the actor at the end.
Answers
So far as I can tell when i put a display text the linear velocity x and y display their values which begin to randomly jump around.. too fast to give specfiic highs and lows.. but i'm thinking i see something between + / - 20...
@BurberryArts give this a shot. I think this is key to this issue! Thank you everyone.. you guys continue to reinforce the truth that GameSalad has THE absolute best community! I've tried other engines and forums and they are never as helpful.
This is one of the reasons I stay with GameSalad! TY!
His solution would work because it uses "stacked" instead of "additive" in the move behavior. I keep forgetting that the default "additive" just adds to the already current movement. (So if its moving at '.1' and you add '0' to it -- it is still going to move at .1) But "stacked" means to set it to that exact value. (So if it says '0' -- it means it!)
http://www.jamie-cross.net/?portfolio=gamesalad-video-tutorial-stopping-an-actor-completely
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page