User Tag List

Results 1 to 7 of 7

Thread: Grabbing physics objects with mouse?

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,196
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Question Grabbing physics objects with mouse?

    Do anyone know how to do this with the new inbuilt physics? Do be able to grab any physics object in the world with the mouse and swing it around and release it?

  2. #2
    Clicker

    Fusion 2.5 Developer
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)
    BtheDestroyer's Avatar
    Join Date
    May 2013
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe you can set a flag or variable (alterable value a for example) to 1 while the mouse is clicked and over the object and then set the X and Y to MouseX and MouseY if the flag or variable is 1. Lastly change the variable back to 0 when the mouse is not clicked or not over the object.

    EDIT: I'm making an example file for you now ;-)

  3. #3
    Clicker

    Fusion 2.5 Developer
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)
    BtheDestroyer's Avatar
    Join Date
    May 2013
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, here's my example

    If you have any questions, feel free to ask
    Attached files Attached files

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,196
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Thanks that is a good start
    There was no gravity or actual physical movement in your example though so I modified it a bit. The only thing that really lacks now is a way to "save" the movement of the mouse so you can throw the objects like when using the old Box2D object. Now when you swing the mouse and release the objects just go straight down. Hmmm
    Attached files Attached files

  5. #5
    Clicker

    Fusion 2.5 Developer
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)
    BtheDestroyer's Avatar
    Join Date
    May 2013
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have to set the gravity to 0 while "Clicked" is 1 and then back to 50 when "Clicked" is 0.

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,196
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Hmm that does not seem to work. Are the gravity value even part of the physics?

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Apr 2007
    Location
    Australia
    Posts
    1,152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Create a joint at the mouse click (while over object) and always position the joint at mouse x and y. Then the object will drag with the mouse and also have physics applied. Remove the joint when the user lets go of mouse click and the object should travel in the correct direction etc.

Similar Threads

  1. Replies: 2
    Last Post: 23rd June 2014, 09:08 PM
  2. Replies: 5
    Last Post: 1st March 2014, 12:31 PM
  3. Using physics objects with non physics movements
    By Redsquirrel in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 11th December 2013, 01:51 PM
  4. Ios Mouse Click and Email grabbing
    By ClickJoe in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 10th July 2013, 10:51 AM
  5. Mouse click w/mouse controlled objects??...
    By WillBellJr in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 30th July 2006, 02:27 AM

Tags for this Thread

Posting Permissions

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