Physics problem at low velocity

PatronusPatronus Member Posts: 56
edited November -1 in Working with GS (Mac)
I have noticed that drag brings down an actor to almost a standstill but thereafter they slowly keep crawling around uncontrollably. What happens is that the velocity goes down constantly, as expected, but then it randomly keeps hovering around -1 and +1, never quite settling on 0. Another person raised the same issue a month ago and one suggestion was to create a rule that kicks in at very low velocity to "force" an actor's speed to 0. The problem with this rule is that it kicks in every time an actor collides with another (because it practically stands still for an instant), in effect making them infinitely sticky, killing the bounce effect.

The problem seems to affect only actors that make use of the drag function. Other actors are stationary, no problem.

Is anyone else experiencing the same problem and have they found a simple solution?

Comments

  • PPenguinPPenguin Member, PRO Posts: 110
    Create a boolean variable that goes true if the velocity is low, and goes false if velocity goes back up.

    Then create a rule with the condition that while the variable is true, after a couple of seconds force the velocity to 0.

    This way, the rule should ignore collisions where the velocity is low for a very short time, and it will kick in when drag brings the velocity close to 0.
    You can adjust the timer so that it doesn't bring the object to a stop too quickly or too slowly.
  • PatronusPatronus Member Posts: 56
    Thanks, I tried that earlier today and there was a marked improvement but it didn't work 100%. I gave each object a grace period of 1 second after its last collision. However some of the objects kept moving ever so slightly no matter what I did, even when my debugging indicated that they are being forced to keep still (meaning the logic was working). Funny thing is, I would zero their velocities on the one line and when I display their velocity values on the next line they have picked up a minute amount of speed again, with not outside input whatsoever. Even when I dynamically changed their status to "non movable" they still wouldn't completely keep still. I also tried to dynamically change the drag value, temporarily while they should lie still, to zero. No Luck. As if they magically got infected by the drag function in the first place never to recover again.
    Did you completely sort out this problem using the above method or was it just a suggestion?

    I tried something else that should work even better but that turned out to be a disaster, for no apparent reason. I completely ditched the drag function for this exercise. Every 0.2 seconds I multiply the X and Y velocities of the actor with 0.85, thereby bringing the velocities down in a realistic manner. Problem is that some actors grind to an immediate halt while others slowly coast to a standstill, as they should. One would swear some timers run faster than others. The actors were exact replicas of each other, containing the same attributes, rules and values. I found that, the more instances there are of the same actor, the more confused the timer gets when it services them all. To the point where a swarm of objects seem to stop in their tracks whereas a solitary instance of the same actor slowly coasts to a halt as it should. As if the timer gets divided by multiple copies of the same actor. So that didn't work either.

    Any further thoughts?
  • PatronusPatronus Member Posts: 56
    Actswartz, I tried it again and after a while the movement completely stops. The only difference is that I now constrained the X velocity to zero in stead of changing it to zero. I don't quite understand why there would be a difference but I think the problem is sorted out. Thanks a lot for the advice.

    tshirtbooth, I also did that initially - thanks for the suggestion anyway.
  • ricardorauberricardorauber Member Posts: 26
    I have the same problem and it's strange to see that Gendai Games didn't do anything about this! On my game the player throws the actor that have to slow down like a pool table but it goes crazy!

    Is there any answer of Gendai?
Sign In or Register to comment.