Whats the formula for modifying relative position overlapping rotating 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.
  • This is a modified schrodinger's example:

    Please login to see this attachment.

    As you can see, the offset is off and I have forgotten completely the math to make it right. I did figure it out before and lost my nice example sadly.

    But I am mostly interested in understanding the exact math, and what each part does.

    1. Find radius of the object by getting the distance from the object overlapping to the overlapped object's X and Y multiplied by 1.0?

    2. get the angle the same way, from and to.


    not sure what these do:

    Code
    + ( Cos(angle_to_obj( "Carried Object" ) - Angle( "Big Object" )) * radius( "Carried Object" ) )
    Code
    + ( Sin(angle_to_obj( "Carried Object" ) - Angle( "Big Object" )) * radius( "Carried Object" ) )

    would be nice to get a small explanation as to what values or formula I require to get the correction in angle and rotation to match up with relative position as exact as possible, as its misaligned and I'm not sure what to look for...

    anyone got any recommendations for game development math books/trigonometry 101?

    thanks...........

  • -eventline 28:

    change

    set X position to
    FinalX( "Carried Object" ) + ( Cos(angle_to_obj( "Carried Object" ) - Angle( "Big Object" )) * radius( "Carried Object" ) )

    to:

    X( "Big Object" )
    + ( Cos(angle_to_obj( "Carried Object" ) - Angle( "Big Object" )) * radius( "Carried Object" ) )

    same for Y's


    -eventline 30:
    remove the two set X position fo "FinalX" / Y position to "FinalY"


    If you want to move the object (the purpose of FinalX,FinalY?),
    you can directly change it's X,Y coordinates


    Even if they may seem counterintuitive at first,
    basic rules of trigonometry are really simple, and extremely handy for lots of things,
    you can find many diagrams and explanations online on the most widely useful functions:

    sin, cos, Tan, ATan(2)

    these are the ones you would surely need more


    The example above simply stores the distance of the diamond object to the center of the blue object (=radius)
    calculates the current angle the object is relatively to the blue object,
    and then rotates the diamond along the circumference defined by this radius

    to rotate something around something else you basically do this:

    1) fix a center of rotation (our blue object X,Y position)
    2) add cos(angle) * radius to X, sin(angle) * radius to Y

    cos/sin(angle) are simply "ratios",
    cos tell you how far horizontally a point lies on the circumference, basing on the angle you specified
    sin does the same for the vertical position
    multiplying these ratios for the real distance (radius) you have the exact X,Y positions your point will get in any given position (angle) of the circumference related to the origin of rotation

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

  • Thanks, however I need for the object overlapping to only have a relative location while still being able to move freely. Sadly, keeping the overlapped objects X and Y and setting it per frame will stick the "Carried Object" in one place (like a pin) and while thats good its not what I want, I just want the position to be affected by rotation, relative to its overlapped objects rotation/
    also thank you Sir for the trigonometry lesson, I'm having issues with it.

  • ewww, I somehow broke it trying to do a conditional rotate, what the heck.....

    Please login to see this attachment.

    Ive no clue why its broken, it doesnt make sense to me. But somehow I am missing important things. No clue.

  • Please login to see this attachment.
    Here is a different way of achieving a "pin" like effect, while still also being able to move and such.

    - BartekB

    Join the Click Converse Discord! - Please login to see this link.

  • You could even just store an "offset" and apply that upon rotation,
    resetting offset shift and updating position

    see above modified example:

    Please login to see this attachment.

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

  • wow thank you both, this is a good example I hope it helps others who have been having the same problem. it is similar to my old example

    as "Cos(ParentAngle( "Child" ) - CurrentAngle( "Child" )) * relativeX( "Child" ) - Sin(ParentAngle( "Child" ) - CurrentAngle( "Child" )) * relativeY( "Child" )" seems very familiar. I'm sure I had borrowed this formula in my old example since I still dont understand it too well.

Participate now!

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