Throwing Objects/Set Position

0 favourites
  • 11 posts
From the Asset Store
Throw daggers and hit the most fruit! Watch out for the wind, if you run out of daggers you'll lose the game!
  • Hi friends.

    I'm making a game where I want to be able to drag and drop an object, but with having it so that if you let go of an object it motion, it will continue to be in motion (like throwing something with your mouse)

    The problems I've encountered with drag and drop and set position is that they immediately halt movement after you let go. Alternatives with "apply force towards position" are way too random and you lose a lot of control over the object.

    Can anyone help me out with a solution?

  • google the forums for "lerp", or use the easetween behavior.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Throwing objects with physics... solution

    Hope this helps.link

  • Thanks for the capx but that's not quite what I had in mind. Basically I want to be able to hold the object with the mouse before throwing it. I looked into easetween and i don't really know if it's what I'm looking for. I can't get it to work correctly. It seems to be for animation rather than physics.

  • i'd find a a way to track the mouse positions at the beginning of the throw and on realease, and time the interval between the two. this should allow you to find the speed and angle of release, then feed that information into the physics object.

    sorry i can't be any more help without trying to build it myself, but have a play around to see if this works.

  • Thanks for the capx but that's not quite what I had in mind. Basically I want to be able to hold the object with the mouse before throwing it. I looked into easetween and i don't really know if it's what I'm looking for. I can't get it to work correctly. It seems to be for animation rather than physics.

    Solution (1 event)

    On drop - Apply impulse 6 toward (MouseX, MouseY) at image point 0

    (Crate uses drag and drop behaviour)

    Edit...The event above doesnt not work !

    This is my latest attempt-

    Throwphysics2

    <img src="smileys/smiley9.gif" border="0" align="middle">

  • > Thanks for the capx but that's not quite what I had in mind. Basically I want to be able to hold the object with the mouse before throwing it. I looked into easetween and i don't really know if it's what I'm looking for. I can't get it to work correctly. It seems to be for animation rather than physics.

    Solution (1 event)

    On drop - Apply impulse 6 toward (MouseX, MouseY) at image point 0

    (Crate uses drag and drop behaviour)

    Edit...The event above doesnt not work !

    This is my latest attempt-

    https://dl.dropbox.com/u/22173473/ThrowPhysics2.capx

    <img src="smileys/smiley9.gif" border="0" align="middle" />

    Oh..That actually works great.

    One problem though. I'm trying to get it to work with right clicking instead of left clicking which drag and drop stupidly doesn't seem to support. How can I do this without drag and drop?

  • Sushin@

    Oh..That actually works great.

    One problem though. I'm trying to get it to work with right clicking instead of left clicking which drag and drop stupidly doesn't seem to support. How can I do this without drag and drop?

    THROW3 EXAMPLE

    (Drag and drop removed)

  • Thanks a lot sir. =)

  • chrisbrobs could you repost the capx? I need the same thing. Thanks!

  • Sushin@

    Oh..That actually works great.

    One problem though. I'm trying to get it to work with right clicking instead of left clicking which drag and drop stupidly doesn't seem to support. How can I do this without drag and drop?

    THROW3 EXAMPLE

    (Drag and drop removed)

    chrisbrobs

    Could you repost the link?

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