Trigonometry Snake Movement

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Please login to see this attachment.

    Hello once more.

    I've been studying the Maths tutorial download for a while now and had some success in creating various segmented things (chains, tentacles etc) using it's Trigonometry section.

    That particular section features this snake, the head following the mouse pointer as the rest of the body flows behind it, but though the guide says it's relatively simple to do, it doesn't expand upon the previous tentacle section to explain how?

    Would anyone be kind enough to share the formula needed to achieve such an effect? I can post a gif to explain a bit more clearly what the snake does if my description is insufficient

    Thanks once again, I've gotten some great tips and pointers from this community so far

  • Would anyone be kind enough to share the formula needed to achieve such an effect? I can post a gif to explain a bit more clearly what the snake does if my description is insufficient

    This sort of thing you wouldn't need manual math, but just a for-each loop through the segments, setting their direction towards the segment in front of them.

    So segment 1, behind head, follows the head. Segment 2 follows segment 1. Segment 3 follows segment 2. And so on.

    A foreach loop can be done with Count > For each object action. There's a PDF guide Please login to see this link., on foreach loops and fastloops, but there's probably other tutorials.

    Darkwire Software Lead Programmer (C++ & C#)
    Please login to see this link. | Please login to see this link. | Please login to see this link. | Please login to see this link.

  • Hi Phi, thanks for your suggestion

    Please login to see this attachment.

    It works reasonably well, but it feels very clumsy and juddery compared to the version done with trigonometry from the tutorial, also when the caterpillar crosses over itself, none of the other sections move

    Please login to see this attachment.

    This is the maths version, which is the effect I'm looking for, as you can see it's far more elegant and precise

  • Try placing them closer together. And if the distance between the current and next one is too small, don't move them; stop the movement there and for the rest of the segments instead.

    If all that isn't smooth enough, perhaps an Easing movement would do it.

    Darkwire Software Lead Programmer (C++ & C#)
    Please login to see this link. | Please login to see this link. | Please login to see this link. | Please login to see this link.

  • That particular section features this snake, the head following the mouse pointer as the rest of the body flows behind it, but though the guide says it's relatively simple to do, it doesn't expand upon the previous tentacle section to explain how?

    Have you looked inside the relevant frame events (called "Trigonometry: Worm")? That part of the runtime doesn't display any formulae the way the tentacle section does, but the frame events themselves are fairly well commented. The main maths happens in event #11, using an Atan2-based equation. Comment #3 gives you some suggestions for which parameters to change.


    Please login to see this picture.

    Please login to see this link.
    My Fusion Tools: Please login to see this link. | Please login to see this link. | Please login to see this link.

  • Thanks for posting that Volk, it looks like he's using an Array to keep track of all the variables, sadly an object I'm unfamiliar with (unless you know of a tutorial?), but it's nice to at least have a better idea how this effect is achieved

    Please login to see this attachment.

    You mentioned looking inside the frame events, which I'd love to, as the file has so many mechanics I'd like to better understand, but the version I have is uneditable as far as I can tell, the only interactions it offers are those as shown in the image above.

    Apologies if I've missed something, perhaps when I purchased the file there was an MFA version too I was unaware of, but I am still a newbie when it comes to using Fusion and this site.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!