interpolating many instances of the same actor(prototype)

FerinFerin Member Posts: 32
edited December 2011 in Working with GS (Mac)
Hey guys,

I'm wondering how to interpolate, in that case vertical position, of lets say five instances of the same prototype.
Exactly what i want to do is when player jumps on the platform it goes down a tiny bit and then goes back to its
previous position.
Do i need to create a game attribute for every instance of a prototype that will contain starting(previous) position
of the platform, from the state before player jumps on it. Or is there a different way of achieving that?

Comments

  • POMPOM Member Posts: 2,599
    edited December 2011
    You can do it with game attribute , but it will be easy to do with self attribute cause every instance of your prototype can go to it self attribute .
    The way i see it , make 2 self.attributes - integer -
    1) Lets call it "jump temp position Y"
    2) Lets call the second "jump landing offset"

    Now in your prototype actor make those rules -
    When the actor lands on the platform : (now we are making the "goes down a tiny bit" part you wanted)
    Change "self.jump temp position Y" to self.position.Y (here we are storing our Y value , so we can get back to it later)
    Interploate self.position.Y TO "self.jump temp position Y" - "self.jump landing offset" (the landing offset can be any number you want)

    A new rule : (now we are making the "goes back to its previous position" part you wanted)
    When "self.position.Y" = "self.jump temp position Y" - "self.jump landing offset"
    Interploate "self.position.Y" TO "self.jump temp position Y"

    Another suggestion is to make an attribute for the process ,
    Like make a self attribute - boolean - and call it "initiate landing effect"
    and use it to trigger the rules i explained above .

    Hope it will help you get started .
    Roy.
  • FerinFerin Member Posts: 32
    edited December 2011
    Thanks for your help Roy.
    I had not time to look at it until now. I did what you said and it works perfectly, but... there is always but ;p
    Because GS doesn't know if actor collides or overlaps with another actor (condition is melted into one),
    platforms are interpolating themselves when i jump through them from below, which i want to avoid since it looks silly
    in that case.
    I'm wondering if there is any way to interpolate platform position only when 'feet' touch the platform from above
    and only from above.
    Another thing that concerns me is when player jumps on the platform, it's moving down and it seems that
    player 'stays' in the air for a fraction of a second, doesn't stay on a platform's surface.
    I set restitution of both - player's and platform's - to ZERO, but it doesn't help. Is there any way
    to stick player to platform when platform is interpolating itself?

    I use TShirtBooth's jump through platforms template (thanks a lot TSB, what we would do w/o U? :D), maybe this information
    will help resolving my riddle.

    I attach my test project file, so anyone interested can look into it and see what i'm talking about.
    test file

    Thanks in advance
  • FerinFerin Member Posts: 32

    Hey guys, a little bump along with the short vid to illustrate my issue(s)


  • FerinFerin Member Posts: 32
    Thank You TSB, that was so simple :D
    I'll try to tweak your idea a little bit more since it still triggers interpolating platforms bit too early.
    I'm grateful for your help guys.
    Happy Holiday btw :D
Sign In or Register to comment.