Speedometer Needle Interpolation

TouchTiltGamesTouchTiltGames Member Posts: 1,162
edited January 2012 in Working with GS (Mac)
I've got my speedometer needle on my dashboard that rotates around when the truck moves. All good except when you Release a button (stopping the truck) the needle continues to rotate clockwise instead of counter.

Needle's rotation is 0 and is pointing to the bottom left of the circle.

when speed=1
Interpolate self.rotation to -152

when speed=0
interpolate self.rotation to 15

I've tried many different numbers...what am I missing here?

Comments

  • beefy_clyrobeefy_clyro Member Posts: 5,394
    This is a gripe i've always had and never come up with a decent answer. If an actor is interpolating you can turn moveable off, however i can't find a way to force clockwise or counter.
    I wish when you were interpolating rotation you had an option for clockwise or counter like you get with the standard rotate behaviour.
  • App SurgeApp Surge Member Posts: 651
    Just thinking aloud, but you could make the needle twice as long as it should be (so it rotates around the middle) and then use the rotate behavior.
    However, the second half of the needle would be off the scene or transparent, so it would look like it's rotate around the end.
    Also, then you could say when self. rotation is more than x, constrain it to x.
    And when it's less than y constrain it to y
    So that way it couldn't rotate a full 360 degrees
  • simo103simo103 Member, PRO Posts: 1,331
    edited January 2012
    Don't know if this will help? .... I stripped out the template I think RThurman made for you re moving the joints of the digger and left just one rotating actor which rotates on a fixed X and Y based on the levers position. Since it rotates both ways I thought you could interpolate the game.lever number to the values you want and it would then move correctly (ie replace the level with values that it was passing). The rotating actor is obviously the needle and would need a twice size actor with half transparent. Hope that makes some sense. Any chance if you do edit the file to make it work .. you could post what you did?

    here's teh file: http://www.funkymunkygames.com/Promo/needle_lever.gameproj.zip
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    I would recommend changing the needle graphic around so that it points directly to the right when the actor is at zero degrees. Like this: ------->

    Then I suggest you have a rule that says:
    When self.speed = 1
    -- Interpolate Attribute: self.Rotation To: 15
    otherwise
    -- Interpolate Attribute: self.Rotation To: 208

    That should give you the results you want.
    RThurman
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Ah that would explain why it was doing that with interpolate.

    Thanks a lot though guys, @ RThurman I tried your method first and it worked.

    Cheers!
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Glad it worked for you!

    RThurman
  • simo103simo103 Member, PRO Posts: 1,331
    @RThurman ... yes appreciated your input (again) ....

    @TouchTiltGames ... the project file I posted could be made into a cool RPM gauge and throttle?!?!? Kids (adults too) might love to rev up the engine and make some noise!

    Anyway love the look of your App so far well done.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @simo103 -- Just to give credit where it is due, I believe the lever demo you referenced came from Tynan (and not me).
  • simo103simo103 Member, PRO Posts: 1,331
    @RThurman ... thanks .. believe you are correct .. have edited and thanks @Tynan ... both of you are great sources of help/templates/math.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @simo103 -- Thanks! I guess a great tool like GameSalad just inspires people! (Actually I just like to figure out how to do things with GS. It really is a great development tool.)

    RThurman
Sign In or Register to comment.