HELP with velocity never reaching 0!

battleduckbattleduck Member Posts: 105
edited December 2011 in Working with GS (Mac)
Hi everyone,
I'm currently working on my first major project which is a top down explosion based physics game, where the player drags TNT onto the screen & detonates it in order to blast crates around the level into defined end-zones. The basics are based on TSB's video for creating a good blast in GS, which i've modified & then I also have different crate types which by using different Drag attribute values make them more or less resistant to the force of the blast.

The problem I have is that once the crates have been blasted around their velocity never actually reaches 0, instead it oscillates between very small +/- values for ever.

I thought I had it cracked when I tried adding a rule to say that when the X & Y velocity is more than -2 but less than +2, change velocity to 0, but the crates still vibrate on the spot which can is first of all unsightly, and secondly means than on occasions when the crate is only just overlapping the end-zone, i can flitter about between being in & out of the zone.

I have tried the above rule using:
1: Change Velocity rule set to 0
2: Change attribute Linear Velocity X to 0 & Linear Velocity Y to 0
3: Constrain attribute Linear Velocity X / Y to 0
4: All of the above with different values i.e. (+/- 1) (+/- 2) (+/- 5) (+/-10)
and nothing seems to do the trick, all of the above variations do eventually stop the crate moving, but sometimes its almost instant and other times it can take anything unto 10, 20 or even 30seconds. Some methods have slightly better results than others, but never consistent results.

Oh an finally, I have also tried a variation of the above rule using Magnitude(LinearVelocityX,LinearVelocityY) but to no avail.

(I don't currently have a paid apple dev account (waiting till after xmas to get the money to buy it!) so is this just an issue with the preview in creator, or can i expect this bug to rear its ugly head when it comes to adhoc testing on an iDevice?)

Any help or suggestions would be greatly appreciated , many thanks in advance.

Battleduck.

Comments

  • battleduckbattleduck Member Posts: 105
    Morning all, any suggestions?

    Battleduck.
  • UtopianGamesUtopianGames Member Posts: 5,692
    It could be the restitution settings in the crates and walls, try changing it to 0 and see if it helps.

    Open up physics on the actors and change restitution to 0.

    Darren.

    FREE GS Templates
    FREE GS Tools
    Video Tutorials
    Forum
    3rd party marketplace
  • battleduckbattleduck Member Posts: 105
    Hey, the restitution is already at 0, the friction was at 50, so i've just changed that to 0 too, and it makes no difference, do you think it might be something to do with drag / angular drag?

    Battleduck
  • battleduckbattleduck Member Posts: 105
    scratch that, just tried removing the angular drag and it made no difference, and i need to drag to bring the crates to a stop at different rates.
  • battleduckbattleduck Member Posts: 105
    Ok, the latest trail and error has revealed that it is connected to drag. If i change drag to 1, as soon as the velocity gets in the threshold in my rule ( listed above) it is instantly changed to 0. this is great except that i need the drag attribute to be much higher than this.
  • battleduckbattleduck Member Posts: 105
    Well i think i've crack it. The problem seemed worse when colliding with the walls, so I've added more friction to the wall actors, and increased the friction on the crates and this seems to have given a more useable constant result.

    Battleduck
  • battleduckbattleduck Member Posts: 105
    Looks like i'm back to square one. Just loaded up GS again to start another session on my game, to find that the above problem seems to have reappeared. this has to be something to do with creator, and not the rules. Even have two identical locked instances of the same crate actor, and they react differently, with one changing velocity to 0 much faster than the other...god knows what the answer is!

    Battleduck
  • battleduckbattleduck Member Posts: 105
    Ok, still havnt solved this yet. Any fresh ideas?
  • battleduckbattleduck Member Posts: 105
    Hey all, just stumbled upon this video, which finally solves this issue once and for all. Many thanks to the Author

  • battleduckbattleduck Member Posts: 105
    Another solution I've found is o set the Self Max speed attribute to 0, then when linear velocity x/y is > -1 and < 1 then change "Apply Max Speed" to true, otherwise Apply Max Speed is false.

    Just thought I'd share.

    BD
Sign In or Register to comment.