Multiple Forces on an Object?

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.
  • I'm trying to make a planet simulator and I'm having some trouble. It works fine with two planets, but when I add a third planet, problems arise. Each planet is only attracted to one other planet. I'm pretty sure it's because of forces being overwritten, because when I move the order to the Always events around, they behave differently.

    Is there any way to combine multiple forces exerted on an object?

    Please login to see this attachment.

    Just ignore the second frame (which is named Frame 1 because it was originally the first frame)

  • I've still much to learn upon the physics engine,
    so keep eyes open and expect better replies (hopefully involving multiple forces XD)

    ... but at first glance I'm doubtful about the possibility to apply more than one force at the same time to a single object.

    I think you'll have to make your own calculations and apply each object the resultant force.

    Here's an idea:

    give each planet its own force value in alterable value A (let's call it "my_gravity")
    apply a qualifier to all of your planets for being able to reference them in just one action
    launch a nested foreach loop for the qualifier, like:

    1) always
    ---> set global value B (let's call it "total_force") to 0
    ---> set global value C (let's call it "resultant_angle") to 0
    ---> start loop foreach planet, name "set planet"
    ---> apply force "total_force" to planet, at angle "resultant_angle"/"total_force"

    2) on loop "set planet"
    ---> set global value A to "fixed ID planet" (this is for storing current planet being calculated)
    ---> set global value D, E to x,y position of planet
    ---> start loop foreach planet, name "calculate force"

    3) on loop "calculate force"
    +fixed id of "planet" <> global value A
    ---> set "total_force" to "total_force" + (my_gravity "planet" / Odistance ("planet", Global value D, Global value E))
    ---> set "resultant_angle" to "resultant_angle" + (OAngle ("planet", Global value D, Global value E)* (my_gravity "planet" / Odistance ("planet", Global value D, Global value E)))
    (this will sum all forces of planets and weighted angles)

    Well.. I'm not so sure about the resultant angle thing, if it's vectorially correct "weighting" angles like this XD
    You may know better about that, if you're into this kind of maths/sciences.
    (Otherwise this may imply splitting into x_y components for multiplying sin/cos values, and revert to back at end to re-calculate the angle....)

    Not so straightforward, I'd say :(
    But doable... I guess

    a selection of my Fusion examples can be found Please login to see this link.

Participate now!

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