Drag and throw a ragdoll with touch

0 favourites
  • 12 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!
  • I'm trying to be able to drag and throw a ragdoll with touch. The controls now are way too jumpy, and I don't know how to approach this. Does anyone have an idea?

    The Project

    Relevant Code

    Thanks!

  • Drag and drop object

    on touch set x,y start points

    on release set x,y end points

    get angle(start.x,start.y,end.x,end.y)

    get distance(start.x,start.y,end.x,end.y)

    To determine speed for object through something ike impulse applied:

    with a simple approach, use the distance as a reference for power. ie The longer someone dragged, the bigger the impulse applied.

    Or you could do something fancy, like, setting begin and end time of the drag too and comparing to distance traveled, then apply impulse proportianally.

  • Drag and drop object

    on touch set x,y start points

    on release set x,y end points

    get angle(start.x,start.y,end.x,end.y)

    get distance(start.x,start.y,end.x,end.y)

    To determine speed for object through something ike impulse applied:

    with a simple approach, use the distance as a reference for power. ie The longer someone dragged, the bigger the impulse applied.

    Or you could do something fancy, like, setting begin and end time of the drag too and comparing to distance traveled, then apply impulse proportianally.

    Thanks, but I think you misinterpreted my original post or I didn't phrase it well, but I'm not trying to get a catapult effect, I want to be able to drag a rag-doll independently and have it's velocity and whatnot carry through once released. But this must all be done through physics otherwise it will mess up all the collisions and such.

  • Thats actually what the effect intended is ...

    Upon release object calc values to aply impulse angle

  • Thats actually what the effect intended is ...

    Upon release object calc values to aply impulse angle

    Alright, it looked very similar to a method I used for a catapult effect in something else. Won't it still interfere with the physics though? I've already tried a method with position.

  • I'm guessing the mechanics are about the same, throwing is just other direction, and the trigger is near same imo..

    Mechanics just differ slightly hehe

  • I'm guessing the mechanics are about the same, throwing is just other direction, and the trigger is near same imo..

    Mechanics just differ slightly hehe

    Unless I'm reading the code wrong, this isn't a real time method, it doesn't drag, so much as teleport.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hmm, I ditched the drag and drop nd tried this:

    web example

    capx

    Its crude.

    Drag and throw gentle.

    Havent tested how it works on touch..

  • hmm, I ditched the drag and drop nd tried this:

    web example

    capx

    Its crude.

    Drag and throw gentle.

    Havent tested how it works on touch..

    Well see that creates issues with other physics objects, look at this:

    here

    that, and once your pointer goes off it stops, which is why I used if is in touch after the initial touch.

  • Then lets prevent that :)

    links and capx updated

    web example

    capx

  • Then lets prevent that :)

    links and capx updated

    web example

    capx

    Hmmm, okay give me a bit, I'll try implementing some into my code.

  • I changed the example in a bad physics basketball   <img src="smileys/smiley36.gif" border="0" align="middle" />

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