Throwing Physics Objects Relative To Mouse Position?

0 favourites
  • 2 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!
  • Title may say a bit, but I'll elaborate

    basically a big part of my game are these physics objects, you can pick them up using a system similar to the drag and drop feature (I was having some weird problems with it so I built a system myself, nothing fancy. It just detects weather or not a play has clocked and held on a object, and if true it sets the object's position to the mouse position until the player releases the object)you do this by holding down the mouse button while over an object

    Now I want to add the small quality of life improvement that is throwing objects, but I can't figure it out. All I need to do is when you let go while the mouse is moving, the object to "throw" and continue moving in that direction while also abiding to the world gravity settings

    For a good example, something like the physics on people playground, MAD2, stuff like that.

    everything I can find on it either is many years old and outdated, or uses some form of the touch function, which doesn't work like I would like it too.

    does anyone know how to do this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • NEVERMIND I actually figured it out

    so even if you are not using touch as a means of detecting and stuff with objects, it's still working, basiclly doing the same thing as the mouse

    all I had to do was add an on touch end action and write this:

    apply physics impulse at angle

    impulse: min(100,Touch.SpeedAt(0))

    angle: Touch.AngleAt(0)

    it was surprisingly simple

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