i am using graphics in a jframe to make a little game im working on...my problem is, i'm new to the application of physics to java...my question is, how do you calculate lets say a force acting on a ball at an angle?
i set up a program the way i thought to do it, i used the force and times it by the sin of the angle and come up with the xComponent and move the ball that far in the xdirection and use cos and determine the movement in the y direction.
heres the catch,
for some force/angle combos, they yComponent will come out as 0.3457467851 or whatever, when i use g.drawOval() i have to cast them to integers so i lose alot of percision.
how could something like this be avoided? ive spent some time looking around google and havent had any real luck in finding a solution...
any help would be greatly appreciated.
thanks in advance,
ken
i set up a program the way i thought to do it, i used the force and times it by the sin of the angle and come up with the xComponent and move the ball that far in the xdirection and use cos and determine the movement in the y direction.
heres the catch,
for some force/angle combos, they yComponent will come out as 0.3457467851 or whatever, when i use g.drawOval() i have to cast them to integers so i lose alot of percision.
how could something like this be avoided? ive spent some time looking around google and havent had any real luck in finding a solution...
any help would be greatly appreciated.
thanks in advance,
ken
Comment