# Drag and throw a ragdoll with touch

0 Favourites
• 12 posts
• 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.

• 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 :)

web example

capx

• ## Try Construct 3

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

Construct 3 users don't see these ads
• Then lets prevent that :)