0 Favourites

[Done!]Objects in Circle Glide to Position

  • This is what I have so far, in a little video here.

    If you watch, as I click the blocks, they disappear and the other blocks take their place. This is because I have it set to calculate the position that each block should by:

    1. Taking 360 and dividing it by the number of blocks

    2. Positioning the blocks at the specified angle away from the little green center block

    3. Calculate distance from the block using Trigonometry.

    Right now, I'm keeping track of every block using arrays, since technically they are all one kind of object, but have different properties.

    So what I would like are suggestions as to - instead of having the blocks suddenly take their proper positions - making them glide to their proper positions in the circle when any one is removed.

    I'm kind of at a loss for how to do it, so anything would be appreciated.

  • Sorry to bump but I'm surprised; no one has anything?

  • I guess rotate toward angle would be a problem, because of the rotation already present?

    I can not see by looking at your youtube video how you have the blocks set up and/or what your further plans are with the blocks once you have this working. It's hard to give advice on how to change something if you don't know where the cange originates.

  • I would use anglelerp(a,b,x), where a is the last angle the instance was at, b the new angle it has to be at, and x moving from 0 to 1 within a certain time. The latter can be done with a variable that you set on every tick while needed to

    var = min(var + n * dt, 1)

    (n being the amount you want var to raise per second)

  • I agree with tulamide regarding using anglelerp to move arrows to their new positions. The tricky part is moving each arrow the appropriate amount so the transition looks smooth.

    Demo

    Capx

  • Actually, I would try and have each check to see if the one behind it is in place, and if not, slow it's rotation until it sees one in place behind it.

    They should all self adjust that way, as soon as one slowed, the one in front of it would too.

  • Thank you all for the wonderful comments!

    LittleStain I agree. If I can't figure out a form using the other suggestions, I will definitely upload something to look over. :)

    tulamide I'd never had experience using linear interpolation before, so I will give it a shot. Thank you!

    Paradox I believe that is also a good suggestion, although, (and I know I don't have an example here) that may not work with the setup I have. I'll try Tulamide's suggestion first and go from there, for now.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • How about on click they all rapidly shrink until they are too small to see, rearrange themselves, and then grow back to the original size showing the new positions. (that would probably also be a lerp, in size.)

  • Well, what I had in mind is actually keeping track of their angles individually using the array I already use for types and such.

    Then I'll just update each position array element individually using AngleLerp like Tulamide said, and have that displayed on screen. :)

  • I did officially get linear interpolation working! Thanks zatyka for the capx file. I did take one line from your project and it was the degree of interpolation. Wasn't sure what to put until I saw your project used dt and then I went "Oooooooooh..." Hahah. So I'll probably be tweaking that value as I go on.

    Again tulamide thanks for the suggestion! That was exactly what I needed. :)

    I'll be updating the screenshots thread with some more progress as I go on.

    Finally, wish me luck using 3D arrays! ;)

  • Congratulations! <img src="smileys/smiley4.gif" border="0" align="middle">

    You're welcome. If you want to dive deeper into the world of interpolation, the next step would be quadratic interpolation:

    live demo

    capx

    <img src="smileys/smiley2.gif" border="0" align="middle"> <img src="smileys/smiley41.gif" border="0" align="middle">

  • Tulamide, you're scaring me hahah.

    Reminds me somewhat of the White Dragons in Castlevania <img src="http://images3.wikia.nocookie.net/__cb20080807153432/castlevania/images/5/56/Whitedragon3.gif" border="0" />

    As well as some clothing physics demonstrations I've seen.

    Thanks for the demos!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)