- Home /
How can I determine force and direction by holding mouse?
Hi friends,
I have made a game similar to basketball. I used my old catapult game code to throw ball, trajectory arc etc.
The problems is that I want to add force using mouse hold. Also determine direction for force using the same.
float x = -Input.GetAxis ("Mouse X");
float y = -Input.GetAxis ("Mouse Y");
Using the above code I am adding the values of x and y for the force vector. And then applying the total force after user releases mouse button.
But is this technique give accurate amount of force? Currently the force is not as accurate as in my catapult game, where I calculate the distance between the midpoint and the pulled ball position and apply force.
The above technique adds force continuously while user is holding the mouse button.
Can you please suggest some good technique?
Your answer
Follow this Question
Related Questions
Set Velocity at relative position. 2 Answers
Can you pls help me fix this rigidbody collision problem 0 Answers
Rigid Body Velocity max 1 Answer
Apply vertical Force then return it to Zero on release Key 1 Answer
object move towards to mouse position 0 Answers