Rotate this!

The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
edited September 2012 in Working with GS (Mac)
OKay, I'm offically stumped. I have an actor that I'm using a magnitude offset to alter the rotation point. This all works well. The trouble I'm having is I would like this actor to rotate in a fashoin similar to a windshield wiper. I've tried using all the methods and behaviors I know. I did get one to work but it was causing crashes as I was using every 0 second timers to force the code to keep going. This is what I don't understand. I set up two rules, one said if self.rotation is 0 then rotate to angle 200. Then I made another rule if self.rotation is = or > 200 rotate to 0. You would think that would work right? Nope it just rotates to 200 and stops. Now here is the rub, if I encapsulate the two rotate to behaviors inside timers set to every 0 seconds, they work and the actor ping pongs as it should but this cause crashes. Throw me your ideas I'm baffled.

Answers

  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    Did you set up a display to see if it is actually going to the 200?

    Just a thought...I come across this from time to time. Sometimes I dont think it goes all the way to the exact x/y mark set inside the interpolate/move behavior. I usually set the rules to activate before the set position. I have the actor move to say 200, but the return rules say to activate when it's equal to or greater than 198.

    May not work for your issue, but I have had this happen before.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    @slickzero yep I always have a debug to see what is going on. Thanx @markontheiorn I'll take a look but while I was waiting to see any ideas I tried interpolating the rotation variable and it seems to work well and responds quickly. Something is fishy with the rotate stuff. Why would it not keep firing as the interpolate are in the exact same type of rule which is monitoring the self.rotation variable? I find this happens also with move to behaviors. Would love to hear a responce from the GS team on these bahaviors and why this is.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    I see what you did there mark and I tried something similar. I see how you are using otherwise to keep it firing awesome. I just wonder why we have to use a proxy attribute when an IF statement should respond to a variable change like rotation..hmmm It seems weird to me.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    So I'm happy to report the interpolate works great and I'm getting a 60FPS even with all my other physics. @markontheiorn I like your way and I'm going to log that project into my stash! The only reason I went with interpolate is because when that actor spawns it's rotation is arbitray and this allows be to do a generic rotation patten of +150 no matter the starting rotation angle.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Without a timer, GS is just going going to check both rules once. It checks the first rule and starts the rotation. Then it immediately (well, actually 1/60 of a second later) checks the second rule and since it evaluates to false, it does not fire.

    After that, the two rules have been checked and they are over. GS is simply waiting for some new rules to process. (Its already checked those two.) If you want to have GS check the rules again, wrap them in a timer.
  • TesseractEngineTesseractEngine Member Posts: 180
    edited September 2012
    @RThurman um, that's not right, is it? 'When's trigger whenever their conditions are met, don't they?

    Am I wrong about that? I thought that was a fundamental way in which GS worked...! :S
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @TesseractEngine -- Now you have me second guessing the explanation. It does seem to me that some things are checked (listened) for on every cycle. Things like events are evaluated continuously. I think.

    But things like attributes are only evaluated once (unless the attribute changes).

    Sorry for the thread hijack if this is irrelevant to FBS's query.
  • TesseractEngineTesseractEngine Member Posts: 180
    @RThurman Thanks for replying. Yeah, I'm not entirely confident about how GS does keep track of everything. Stuff works, but sometimes works contrary to my expectations.

    @MarkOnTheIron's gameproj above doesn't use a timer, and nor does my quick-and-dirty suggestion from this thread: http://forums.gamesalad.com/discussion/comment/345955/#Comment_345955 (note @tenrdrmer's really neat suggestion to tidy it up too) which is kinda similar but less accomplished, so GS must be tracking those Rules continuously. I guess. :D

    Likewise, apologies to FBS for the hijack.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Ah no problem. I was going to say what I ended up doing used the same rules I had that wasn't working and the only difference was instead of using rotate to I used interpolate. So the rules are scanned ever pass but it seems the rotate to doesn't fire. I have found this to also be true with move to.
Sign In or Register to comment.