User Tag List

Results 1 to 8 of 8

Thread: Creating a joint with the mouse click

  1. #1
    Clicker Fusion 2.5 (Steam)

    Join Date
    Mar 2019
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Creating a joint with the mouse click

    Hi there,

    I'm not so advanced in Clickteam Fusion, so I want to know how do I create a joint when the user clicks on an object and how do I position it on the mouse X Y, using the Physics engine.

    Basically what I am trying to do is, grab a physics object with the mouse cursor and being able to throw it with the strength depending on the cursor speed. But in many threads, I have seen that I need to create a joint when clicking with the mouse over the object, set the joint position at mouse X Y, and destroying the joint when the user releases the click, and I don't know how do I do that.

    Could someone please help me with that? An example would be great if possible . Also sorry if my English is not so good.

    Thanks

  2. #2
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Feb 2017
    Posts
    325
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Here is it for drag but for drag and throw i don't know, because now if you release the object it just falls down
    Attached files Attached files

  3. #3
    Clicker Fusion 2.5 (Steam)

    Join Date
    Mar 2019
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Manuel View Post
    Here is it for drag but for drag and throw i don't know, because now if you release the object it just falls down
    Thank you so much, your help was great! I will just try to mess around to see if I can make a way of throwing the objects too.

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Feb 2017
    Posts
    325
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    I think to "throw" the best way is to do it with the distance joint.
    Attached files Attached files

  5. #5
    Clicker Fusion 2.5 (Steam)

    Join Date
    Mar 2019
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right! I guess I will go with this way since I didn't really get a good result. I've mixed your code with another that was a bit similar to what I wanted and I added loops, but it still has some bugs and I might fix it later. Thanks for your help, I really learned more about the joints today.

    If someone wants the mfa of my unfinished version, here it is:
    Attached files Attached files

  6. #6
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Feb 2017
    Posts
    325
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    To be honest, i dont think its possible to make a professional grad mousejoint by faking it. You would just need a real mousejoint implementation from box2d.
    If you look very closely in the examples with the revolute joint i posted you will notice this negative behavior; if you drag the object it lags behind the mouse and sometimes the joint even breaks and the object cannot be thrown.
    In the second example with the damping joint (spring); you cannot grap the object at a exact position the joint is always created at hotspot or action point (i did just not find a way to create it at the exact mouseposition), and beside that a damping joint is just not a mousejoint but it works for throwing objects.

    A mousejoint should have this behaviours; created at exact position where you click the object (like revolute joint), object follow the mouse accurate with no frame delay, joint does not break, object is released and still moves in the world (thrown).

    Joints that are missing in fusion and not really doable: motorjoint, mousejoint, gearjoint, weldjoint
    Of course you can kind of fake them like we try here, but its just not the same as you see.

    Good luck Bro

  7. #7
    Clicker Fusion 2.5 (Steam)

    Join Date
    Mar 2019
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, you're right. The built-in physics engine of Fusion needs a mouse joint feature. This would make more possibilities for sandbox games like what I am trying to do. I have seen that Box2D has mouse joints but it seems so complicated and harder than the physics engine for me, but maybe I can try to learn more about this extension, I'll see what I will do. Again, thanks!

  8. #8
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Feb 2017
    Posts
    325
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Here is another more advanced drag and throw example with multitouch support - you can hook objects at a specific position and drag them via distance joint.
    Attached files Attached files

Similar Threads

  1. Mouse Joint Physics Exampe
    By Vetmora in forum Android Export Module 2.5
    Replies: 1
    Last Post: 11th November 2016, 12:19 PM
  2. Add a joint at mouse x,y
    By Tuna in forum Fusion 2.5
    Replies: 17
    Last Post: 15th December 2013, 05:29 AM
  3. Mouse Movement prevents mouse click event?
    By Tuna in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 2nd March 2008, 02:52 AM
  4. Mouse click events runs faster when mouse moves
    By chrilley in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 2nd February 2007, 02:54 PM
  5. Mouse click doesnt work when Mouse movement used
    By Blizna in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 21st September 2006, 02:24 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
  •