I have a problem on Physics with DragDrop behaviour. Whenever I tried dragging an object with the physics behaviour, if I would to stop moving(Still holding down/dragging), it will fall because of the gravity. So, I decided to set world gravity to 0 when object is dragging/On start drag. Then, set world gravity back to 10 once drop/not dragging. The problem is when I'm playing around with more than 1 object with both behaviours, can cause others to get 0 gravity while dragging one of them. That is why I decided to make this thread and hopefully an individual Gravity event is implemented. The platform behaviour does a great job but not the Physics behaviour. Is there any turn around for this matter? Thanks! :)
Couldn't you just use while dragging set physics disabled?
I got a workaround by setting the world gravity to 0 and apply force X=0, Y=10 when not dragging. It works! But still hope to have that individual gravity implemented. Will Box2DWeb come out with something like this? Cheers :)
There's the option to set physics disabled, or temporarily immovable while dragging, then there are many options to set friction, density, etcetera.
I don't see what gravity per object would add to all the functionality already present.
I'd wanted that throwing effect. Disabling the physics behaviour doesn't work. But thanks anyway!
Develop games in your browser. Powerful, performant & highly capable.
Maybe you can replace the object that is being dragged with another object that carries the same sprite while being dragged, and switch back to phsycis object as soon as it is dropped?
Unfortunately the example capx of the drag and throw effect (as found in the FAQ) seems to be unavailable at the time, but making that effect is entirely possible.
Instead of drag and drop could you just apply a force in the direction of mouse.x,mouse.y based on the distance the mouse travels?
works best when you set velocity directly
Have found a few different times in my games when it would be nice to have individual world gravity's per item or family. I have found work-around's for every situation but some of them get complex quickly and this would be a great feature.