Turning off physics

HappyKat78HappyKat78 Member, BASIC Posts: 173
Hi,

Like many people I'm not using the scene gravity, rather accelerate downwards on each actor to trigger physics. However, once the level is complete I want all of the actors to stop where they are (while I show a popup level complete window). I've tried turning off moveable, making the acceleration 0, and the only way I can get this to work is when the level complete is triggered I load two local attributes (LockX and LockY) with the current X and Y of the actor and then constrain the actor's actual X and Y to the respective local attributes. This works fine but I'm obviously setting up quite a few constrain attributes which I know are memory hogs.

Does anyone have a less memory intensive way of stopping the physics once it's started?

Thanks,

HK

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
  • GS_MasterGS_Master Member Posts: 159
    edited July 2013
    change velocity to 0?
  • HappyKat78HappyKat78 Member, BASIC Posts: 173
    Thanks for the tips guys. Unfortunately changing velocity doesn't work either and the built in pause behavior is designed to jump to another scene and back. My other option (rather than constraining attributes) is to jump to a level complete scene instead, but I thought it looked better to have a popup window. Seems odd that there isn't an easier way. If anyone thinks of anything please post it here. :-) Thanks!
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    change self > motion > linearvelocity x and y to 0
    you may also want to change angular velocity whilst there to 0 as well
    if you are applying downwards acceleration, you will need to stop that too
  • HappyKat78HappyKat78 Member, BASIC Posts: 173
    Thanks @beefy_clyro. Tried these and they don't work. The actors still float downwards. I may just use another scene to get around it for now.
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    If you use the pause function, place your level complete window in the pause scene so it shows on top of your paused game. Set an attribute called level complete to true and when you unpause check to see if that attibute is true and go to the next scene, just a thought, it might work well enough.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    It seems that GS is evaluating things just a smidgen too fast. If you place the change attribute inside a "0" timer, it will stop.

    When gravityOn? is true
    ---Accelerate 270
    otherwise
    ---Timer , After 0 seconds
    -----Change Attribute: Self.motion.LinearVelocity.Y To: 0


    Timers are kind of resource hungry as well. But it does slow down the processor enough for 'momentum' to come to a complete halt before GS moves to the next instruction.
  • HappyKat78HappyKat78 Member, BASIC Posts: 173
    I'll give this a shot, thanks!
  • LumpAppsLumpApps Member Posts: 2,881
    The Move behavior overrules all motion. Use a move behavior and set de speed to zero.
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    It seems that GS is evaluating things just a smidgen too fast. If you place the change attribute inside a "0" timer, it will stop.

    When gravityOn? is true
    ---Accelerate 270
    otherwise
    ---Timer , After 0 seconds
    -----Change Attribute: Self.motion.LinearVelocity.Y To: 0


    Timers are kind of resource hungry as well. But it does slow down the processor enough for 'momentum' to come to a complete halt before GS moves to the next instruction.
    Yes it does, i've had to use this technique many times
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited July 2013
    I usually use a constrain attribute as it holds it a zero. Always works for me. Also make sure you lock out any rules that make it move. So have a pause Boolean and make it one of the conditions in all your physics rules. Wish they would fix the friggin pause behavior. I've sent in bug reports and even talked to @codewizard about it. It screws up multitouch and a host of other things. Yet even though the new team is very good at fixing things, they haven't done a full work up on pause or even addressed the issues I documented and sent in test protects.
  • SocksSocks London, UK.Member Posts: 12,822
    Wish they would fix the friggin pause behavior. I've sent in bug reports and even talked to @codewizard about it. It screws up multitouch and a host of other things. Yet even though the new team is very good at fixing things, they haven't done a full work up on pause or even addressed the issues I documented and sent in test protects.
    It could just be limited resources. I'm sure all of you with big company management experence already know about that. :-/




    :))
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    They do have limited resources. What I am suggesting is they devote some of those resources to fix an existing issue and not create other items as some ask for. That's why you never see me aking for new stuff as I understand they must fix the existing issues first but not many on these forums understand that. Once agin nice try but as the Who so rockingly said "We won't be fooled again, no, no"
  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2013
    Piman was talking about a longstanding issue with windows losing their positions / layout, he wasn't asking for a new feature, it is an existing issue.

    As for you having been 'fooled', no one 'fooled' you or 'tricked' you into doing anything, your actions are your own responsibility, you simply ran into trouble for being unnecessarily aggressive.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    I don't believe my comments in that thread were specific to his post. Sorry you took it that way but I was making a general statement on the wish lists.
  • SocksSocks London, UK.Member Posts: 12,822
    I don't believe my comments in that thread were specific to his post.
    :))
  • RPRP Member Posts: 1,990
    Something stinks. The scent of insecurity perhaps? I've noticed a cycle and a peculiar approach to one-upmanship for the silliest of matters (can't even be wrong or criticized, but is the first one to criticize). You are the one turning it into a negative Mr. Cube, or Mr. Horse or whatever your avatar and persona is today (depending on your mood). There are a few recent posts where you have decided to take things negatively rather than taking them positively (you are not a victim or being persecuted). Just pointing that out. Give it some thought and keep it positive please.


    Back on the topic and knowing what Mr. Bacon had to in order for physics to stop in our game (which there was a butt-ton of), I think he's got an idea what's going on here.
  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2013
    . . . can't even be wrong or criticized, but is the first one to criticize . . .
    First one to criticize ? Not at all, I think you will find it was your partner who was first to be unnecessarily hostile.
    . . . Mr. Cube, or Mr. Horse or whatever your avatar and persona is today (depending on your mood).
    What on earth are you on about, my avatar is a cube, my previous avatar was a horse, does changing your avatar mean you are changing your mood / persona ? You really are clutching at straws here.
    There are a few recent posts where you have decided to take things negatively rather than taking them positively (you are not a victim or being persecuted).
    Seriously !? :) I think you need to pay a little more attention, I've never claimed to be persecuted, whereas the same cannot be said of your partner who has, on more than one occasion, alluded to having been the victim of a plot against him as well as having been 'fooled' or 'tricked'.

    I think there is a wonderful example of 'can give it, but can't take it' here, FBS' unnecessarily sarcastic contribution to a previous thread is apparently all good and well, but when the boot is on the other foot (and addressed using his own words) it suddenly becomes 'oneupmanship' ?

    Lol, but I do admire your dogged loyalty even in the face of such poor logic, hey but when there is little logic to your argument feel free to do the whole 'something stinks', 'insecurity', 'oneupmanship', 'negative', 'can't even be wrong', 'questionable avatar' . . . ad hominem route, it's better than nothing.

    :)
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    @RP @Socks @FryingBaconStudios

    How old are we lads? This is going on for a bit now. Either get over it or get a room ;)
  • SocksSocks London, UK.Member Posts: 12,822
    @RP @Socks @FryingBaconStudios

    How old are we lads? This is going on for a bit now. Either get over it or get a room ;)
    There's an image I'll find hard to get out of my head :))
  • RPRP Member Posts: 1,990
    edited July 2013
    Oh boy... Sorry, but you've got issues there mate. I'm not going to respond to the majority or your nonsense because once again..... there you go.

    If there was any instance that you could have cleared up a misunderstanding (sarcasm included) with FryingBaconStudios, you could have done it in you second post, which you did not. Instead, you played the victim card (looks to me as you took a shot right from the start). Oh, and sweet pea, it's not just this thread.

    Loyalty has nothing to do with it. I saw you doing "your thing" again and called it out. Don't try to group me because of what I said, this is not a mob (victimizing tactic #2). This is me, to you...dude.

    As for the rest, use that brain power you have and think about what I said (and where it may apply), instead of assuming your are vastly more intelligent than everyone else.

    I'm done on the topic.

    Sorry @beefy_clyro but I'll address things as I see them. It's not an age factor, not that, that matters AT ALL on these forums. I don't find the situation amusing. A Sous can clean up the thread and keep it strictly on topic. I'd keep it to PM, but when I see something occurring at the source, I'll call it out right there. I've said my piece and that's that. Moving on...

    @all I apologize to all from contributing to off-topic and turning this thread into an unpleasant mess.
  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2013
    I'm not going to respond to the majority or your [post]
    Like I've said there's nothing to support your argument, so it's hardly surprising you are not going to respond.
    . . . you played the victim card . . .
    Well I certainly don't feel like a 'victim', I've made no claims that I am a victim, so I'm still not sure quite what you are talking about here ?
    As for the rest, use that brain power you have and think about what I said (and where it may apply), instead of assuming your are vastly more intelligent than everyone else.
    Again, I'll just reiterate my earlier point, you appear to have little in the way of an actual argument here so need to rely on this silly ad hominem . . . no one here, not myself, nor FBS, nor anyone else on this thread for that matter, has mentioned that they feel they are 'vastly more intelligent than everyone else', absolutely no one, so quite where this has come from is a little puzzling . . . I'll hazard a guess that you want to criticise me - in support of your partner - but on reflection find little to actually base it on, so in lieu of an actual criticism we get these silly ad hominem attacks and allusions to things which you fail to evidence . . . apparently I feel I am vastly more intelligent than everyone else (WTF?), I change my avatar depending on my mood / persona (WTF?), I'm insecure (WTF?), I'm playing the victim (WTF?), I have 'issues' (WTF?), I feel persecuted (WTF?) . . . etc etc.

    Honestly if you feel I've done anything wrong, something you can actually articulate, then come out and say it, I'd be happy to clarify any misunderstanding. In the meantime I'd drop the insults, they're not getting you anywhere.

    And if you'd like to discuss this via PM I'm happy with that too.

    :)>-
  • ericzingelerericzingeler Member Posts: 334
    @HappyKat78

    How'd that workout?

    I've had to use the move behavior = 0 with stacked turned on to get things fully stopped. As mentioned in the thread earlier, you'll have to kill the accelerate behavior first.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    Geez -- what an interesting thread!

    Anyways, if you don't want the added bulk of a timer, you can also adjust max speed to get things to stop quickly.

    Go into the actor's Motion settings and check "Apply Max Speed". Then make a rule that works something like this:

    When gravityOn? is true
    ---Change Attribute: self.Motion.Max Speed To: 500
    ---Accelerate: 270, Speed: 500
    otherwise
    ---Change Attribute: Self.Motion.Max Speed To: 0
  • mataruamatarua Auckland, New ZealandMember Posts: 854
    I have had some issues constraining an actor to another actor a bit (creeping down) and by setting up an attribute that is called gravity and is a boolean - then a rule inside your actor that states only if gravity is true then accelerate ### & ### - otherwise accelerate 0 & 0 - this means the constrain of the other actor is now powerful enough to capture the actor when they collide, the other actor changes the attribute gravity to false and captures my main actor much more smoothly now - thanks to the discussions here. Cheers :)
  • HappyKat78HappyKat78 Member, BASIC Posts: 173
    Thanks guys. To summarize, I found the move command alone (set to zero) works fine. The actor does seem to move 1 or 2 pixels when it kicks in but this is good enough for what I need.
Sign In or Register to comment.