Help with an equation!
Posted: Sun Nov 07, 2010 11:27 pm
Hello all,
haven't been here in a while... Anyway, science fair time is rolling in again for my school. I am working on a golf physics simulator and have worked out many bugs except for a major problem involving the velocity of the ball (or in Game Editor language, the yvelocity...) The compiler displays an "incompatible type" error.
All of my variables are Real numbers:
m = the angle of the club in degrees
initVel = the initial velocity of the ball
mass = 49.6 (average mass for a golf ball, in grams)
club = mass the club head (in grams)
vball = ball's velocity (defined earlier in the program), using the code:
Here is the bugged code:
for some reason, the compiler does not like when I use powers. Is there any way to fix this? I don't want to simply multiply the cosine of m by itself... There's GOT to be an easier way!
As always, thanks in advance!
-Tlah
haven't been here in a while... Anyway, science fair time is rolling in again for my school. I am working on a golf physics simulator and have worked out many bugs except for a major problem involving the velocity of the ball (or in Game Editor language, the yvelocity...) The compiler displays an "incompatible type" error.
All of my variables are Real numbers:
m = the angle of the club in degrees
initVel = the initial velocity of the ball
mass = 49.6 (average mass for a golf ball, in grams)
club = mass the club head (in grams)
vball = ball's velocity (defined earlier in the program), using the code:
- Code: Select all
vball = ((initVel*1.67))/(1+mass/club)))
Here is the bugged code:
- Code: Select all
ball.yvelocity=((cos(m))^2*(sin(90-m))*vball)
for some reason, the compiler does not like when I use powers. Is there any way to fix this? I don't want to simply multiply the cosine of m by itself... There's GOT to be an easier way!
As always, thanks in advance!
-Tlah