I am stuck with this :
Drag and drop an object (sprite) with Physics (Gravity 0) > OK
When finger-mouse released, the object must slide depending on drag speed.
(Like a hockey puck thrown on ice ) ??
I doubt, that drag and drop will translate to physic force....
did you take a look at the objects velocity during the drag. Is it != 0?!
The object velocity is == 0 during drag but I can calculate Delta.X and Delta.Y during the drag.
So what you have to find out is the velocity and the angle of the drag and set these values to the draged object on release....
Develop games in your browser. Powerful, performant & highly capable.
I did that but the trouble is I calculate the velocity everytick and as soon as I release, the velocity goes to 0 ....
cant you store the last calculate vel into a global variable so you could set it to the onject on release?
OK, I found a solution, it must be tweaked :
Weishaupt : Thx for helping
What solution did you come up with? The capx doesn't work now.
Ok I have an idea!
calculate the distance between the touch and release point
and also the time between and you can find out the speed.
If you know the speed you can calculate the normal velocity and acceleration.
Then you have to se the object acceleration to the acceleration you just found out.
the formulas you'll need are:
average speed = delta X / delta t, it means the distance between the touch and the release devided by the time.
average velocity = delta S / delta t
average acceleration = average velocity / delta t