Download

Mouse Throwing

Hello, I’ve been trying to make an object throwing system like in Pokemon Go, but I can’t figure out how. This is what i have so far:

f489ed9f50b5c3dcceb4e90e8ef8bf9bac374655.jpeg

I think I need to calculate the screen position aswell but I can’t figure out how to get the correct location. Does anyone have any ideas about this? This is what the game looks like at the moment(I started it yesterday, no actual graphics yet):

0a51fd2876814d1909b7f3ef171ca1f3968f7a69.jpeg

Imo save vectors in tick and on mouse release compare last 2 vectors… like when first frame is vector 0 0 0 and second is 1 2 5 then subreact and multiply that values by something and launch ball… im really not sure if this can work but its a shot :slight_smile:

Thanks for the reply! I thought about that but the problem is I want the player to use some “Force” while throwing it. If I do it this way you can slowly push it forward and release it 20 seconds later and the ball will still move forward with a lot of force.

No no because you compare only last 2 vectors :slight_smile: time wont affect force… only position between last 2 frames
Another thing is that you can truly make only “2d” vector with mouse… x and y… z must be calculated based on x and y between last 2 vectors somehow… :slight_smile:

I see what you mean. Could work, but right now the main problem is I can’t make the ball to follow the exact location of the mouse :frowning: