0 Favourites

Physics objects drag and drop with using pivots

  • Hi All,

    I am trying to have allow a sprite to be picked up by it corner and have the physics engine decide how the sprite rotates when picked up see image bellow for an example.

    <img src="http://vine99.com/temp/gravity.jpg" border="0" />

    Thank you in advance for any help.

  • I think you would need to set a image point in each corner of the sprite, and pick out the closest image point when you click on the sprite.

    With this image point, you can make a revolute joint between the sprite and the mouse pointer.

  • Thanks for your reply, I would like the image point to be selected dependent on where the cursor is when the Sprite is dragged.Do you know of any way this is possible?

  • Here it is:

    Physics drag and drop example

    Since there's no way to destroy a joint after it is created you need to destroy the object.

  • Thanks for the quick response, unfortunately when I try and run the file it says that it "cant open it chrome, please update your browser". every other sample game work and chrome is up to date? not sure what to do, I have turned off my firewall still have the same problem. Any ideas?

    Could some one else try the file, so I can see if its my set up at fault.

  • Right, I got it working in Firefox now but still have a problem with Chrome, not sure whats going on, maybe its a bug. It works fine in chrome on my laptop. I might try a re install, I tell you how that pans out.

    About the file it works great apart from you need to double click in the box to drag the sprite. is there a way to correct this? Any Ideas.

    many thanks for your efforts so far? what a fantastic community. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Just an update I have re-installed construct2 and it all works fine, still trying to figure out how to pick up the box without double clicking, if any one can help it would be much appreciated. Many Thanks.

  • I don't know why it's not working sometimes, maybe it's a bug.

    I modified the events a little an now it works:

    Corrected example

  • Animmaniac thank you so much for time you have put in, It still seems to have the same behavior for me. The block can be moved whilst its moving but you still need to double click to pick it up first time. I am playing with it but cant find a work around (but I am a Novice at this). Great solution to the original problem by the way.

    On a unrelated issue the files you are putting up wont open in chrome, I get an error, by chance are you running windows 7, 64 bit? As the files run fine on my 64bit laptop.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Strange behavior. When I changed it before, everything was working fine. Now that I re-opened the file it doesn't work every time. Almost seems like if I stay messing with it and previewing for a while it works. Then if I close and come back later it doesn't.

    By the way it works fine in Chrome, and I'm running in win7 32bits desktop.

    Edit: I just noticed that for some reason it doesn't work in Firefox, only in Chrome.

    Edit2: Forget what I said, it works randomly and buggy. Let's hope someone can shine a light on it.

  • I used Anim's example - this works

  • Hi Animmaniac

    with a bit of playing I have managed to get it working how I want, Thank you so much for help its much appreciated if you wish I can put up the finished result so you can have a look.

  • Hi vine99, I'm new here and saw that you encounter the same problem as I do. Indeed I'd be very happy and greatful if you could share your solution!

    Thanks a lot!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)