User Tag List

Results 1 to 8 of 8

Thread: Rotate active object about a point

  1. #1
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Sep 2008
    Location
    Western Australia
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Rotate active object about a point

    Is there a way of rotating an active object about a point that is not within that object?

    e.g. If I have an active object at screen coordinate 400,300. Is it possible to rotate it around screen coordinate 200,200 at a specified angle?

    I need to do this for a SWF exported app, so extension use will be limited. In Actionscript, I would use a transformation matrix. Another method would be to place the object to be rotated in a larger, invisible, object placed at the rotation coordinate. Not sure how to achieve this in MMF2!

    Thanks.

  2. #2
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,540
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotate active object about a point

    You would need to both reposition the object and adjust its angle.

  3. #3
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Sep 2008
    Location
    Western Australia
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotate active object about a point

    You would need to both reposition the object and adjust its angle.
    Thanks for the reply.

    I just had a quick go at rotating an object around a point using:

    objectX = CentreX + Sin(Angle) * radius
    objectY = CentreY + Cos(Angle) * radius

    Repeatedly incrementing "Angle" does the job and it works as expected. However, I also need to change the angle of the object so that it looks like it is rotating around the CentreX,CentreY point, but I can't get the angle of the object to match up with the rotation of the object around the centre point; it's very close, but it either rotates too fast or too slow.

    Currently, the object looks something like a planet following an orbit whilst it is spinning. It needs to look more like, e.g. looking from above at a car driving round a roundabout in a consitent manner.

    Does that make sense?

    Any ideas as to how I can 'synchronise' the rotation of the object with its rotation around the centre point?

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotate active object about a point

    The idea of increasing the angle every frame sounds wrong to me. Besides, if you do have the angle already (the one you use for sin(Angle) and Cos(Angle)), can't you determine the display angle of the object from that?

    If you want to set the direction, rather than the angle of the object, just set it to Angle / 11.25

  5. #5
    Clicker Multimedia Fusion 2
    DanDaBear's Avatar
    Join Date
    Feb 2010
    Location
    Massachusetts
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotate active object about a point

    If it is always rotating around a fixed spot, couldn't you just have it "look towards" that spot?

  6. #6
    Clicker Multimedia Fusion 2 DeveloperHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    drnebula's Avatar
    Join Date
    Jul 2006
    Location
    Pennsylvania, USA
    Posts
    908
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotate active object about a point

    I just did a simulation like this. I used the sin and cos for the circle and changed the angle to get the object to move in a circle. I changed the angle of the object moving in a circle, again by using the angle that was used for the sin and cos. But I had to adjust the angle to make it all synch up. So one might just be the angle and the other might be the angle +90 degrees.
    Steve

  7. #7
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Sep 2008
    Location
    Western Australia
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotate active object about a point

    Thanks; I'll give it another look and have a play with the angle of the object. It wasn't far out in my initial test - just "not quite right" - but it has to be spot on because the application is about transformation of shapes on an axis!

  8. #8
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotate active object about a point

    sorry Digitalic,

    But this is actually a prelude to a more serious issue.

    when you change the angle of an object it actually rotates around that objects hotspot.

    While it is possible to position the object as a whole as if was rotating around a point other then it's hotspot, the image itself will still be rotating around the original hotspot.

    There is no clever math to avoid this one, you will either have to use an object which allows for dynamic hotspots, or you will need to load each sprite from an external file and use that functions hotspot parameters, however this is not computationally effective if the point is dynamic.


    Easy answer:

    Use another extension, active picture has an option to 'set hotspot' this will negate the need to set the objects position manually, as the sprite will rotate correctly since mmf has a one to one correlation in object and sprite space.

    pros: simple from a programming POV. computationally effective.
    cons: scaling won't work (but that cauld be added with relatively simple math)

Similar Threads

  1. Player controlled active object orbiting around fixed point?
    By ratty in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 10th June 2012, 05:21 AM
  2. Help Please... Need to Rotate Rotate object with a wheel
    By Tuna in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 12th February 2012, 05:48 PM
  3. Action Point on Active Picture Object
    By reptilezero in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 30th January 2012, 12:35 AM
  4. How do I scale (and/or) rotate an active picture?
    By Aloan in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 9th September 2010, 01:02 PM
  5. [help] calculate point on rotated active as if....
    By nightofgrim in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 23rd January 2008, 06:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •