PDA

View Full Version : Calculating Y Angle


MstWntd
Dec8-08, 08:14 PM
1. The problem statement, all variables and given/known data

Hi All,

I have this code for my Games Project to calculate the Projectile maths for an arrow

[C++]
mPosition.y = ((pmVolYint * pmTime) + (pmAcc * (pmTime * pmTime) ) / 2) + 18 * sin(pmFAngle*(PI/180));
mPosition.x = ((pmVolYint * pmTime) +
((0.065* pmWind * pmArea) * (pmTime * pmTime) ) / 2) + 18 * cos(pmFAngle*(PI/180));

mVelocity.z = 0.065 * pmWind * pmArea * pmTime + pmVol;
pmTime += pmTimeInc;
[/C++]


What I would lik to do is calculate the new Y (Up/Down) roation produced over time pmTime.

2. Relevant equations

I dont have any :blushing:


3. The attempt at a solution

mRotation.y = 18 * sin(pmFAngle*(PI/180));

and

mRotation.z = (pmAcc * (pmTime * pmTime) ) / 2) + 18 * sin(pmFAngle*(PI/180));

Please do help and any help is greatly appriecated.

Thanks.

MstWntd
Dec9-08, 11:17 AM
This isnt a home question..I just put it in here because its so basic..but in order to get my arrow to tilt as it moves I really need its new Angle..someone help!

MstWntd
Dec9-08, 05:00 PM
Is there something wrong in my post?

I have to get the behavoir of my game right by 3pm Thursday and I still have to do the documentation!

Please help me out on this :uhh:

turin
Dec9-08, 06:54 PM
Is there something wrong in my post?

I don't think many people here want to try to interpret computer code. Sorry.

MstWntd
Dec10-08, 04:37 AM
oh, its same as a maths equation, i think. I'll change it :)

T= Time traveled
W = Wind
A = Area
F = Flight Angle
V= Volicity of Y
G = is the gravity
PI = pie

Y = ((V_{0} T) + (G(T^{2}) ) / 2) + 18sin(F(PI/180))


T= Time traveled
W = Wind
A = Area
F = Flight Angle
V= Volicity of Y
PI = pie


X = ((V_{0} T) +
((0.065 W A)(T^{2}) / 2) + 18cos(F(PI/180));


Ok, so yeah, how will i calculate the new X and Y angle as the arrow is flow over time?

turin
Dec10-08, 01:18 PM
I'm sorry. I still don't follow.

From your overall setup, I would assume:
- "time travelled" is like the number of ticks on a clock that occur after the arrow is shot.
- "volicity of y" is velocity in y-direction?
- "gravity" is the acceleration due to gravity (i.e. 9.8 m/s^2)
- "pie" is \pi, the ratio of circumference to diamater of a circle (and actually spelt as "PI", :>)
Does this look correct?

Please explain what you mean by:
- "wind" (is this a force or pressure?)
- "area" (area of what?)
- "flight angle" (I have no idea)
- "X" and "Y" - they look like Cartesian coordinates, but you are calling them angles ...?

The first part of the expressions for X and Y look like ordinary kinematic equations, but I don't understand the trig parts.

MstWntd
Dec10-08, 08:11 PM
Sorry, X and Y are indeed Cartesian coordinates.

wind and area are not a factor.

flight angle, is the inital Y angle.

I would know less then you about the equations used here, i ripped it off an example i found. :shy:

at the moment I am calculating the maxhight of the arrow and after it reachers that, i negate the current Y angle.

cheap hack, but yeah has the same effect in the end, however i wud rather have it more dynamic :)

turin
Dec12-08, 12:45 PM
wind and area are not a factor.

Then why did you put them in your equations? We either need to understand what you mean by "A" and "W" (mmm, root beer), or you need to try some different equations.




flight angle, is the inital Y angle.

What is a "Y angle"?




cheap hack, but yeah has the same effect in the end, however i wud rather have it more dynamic

Huh? What effect? More dynamic than what? I should tell you that I still have no idea what we're talking about.