• ### What is your GameDev Story?

#### Archived

This topic is now archived and is closed to further replies.

# Basic Math Question

This topic is 5354 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

This is probably a silly question to most, but I'm having difficulty figuring out what is wrong with my math here. I don't have a good math background and am sort of learning as I go from internet / books / etc. Basically, I have a car with 4 tires and I'm trying to determine the pitch of the car from the height at each tire. Here's some pseudo-code of my current attempt: Difference = (RearTire1Height + RearTire2Height) - (FrontTire1Height + FrontTire2Height) CarPitch = Asin(Difference) The resulting pitch is very exaggerated from what it should really be. I can hard code a "magic number", like: CarPitch = Asin(Difference * .125) and the result is very close to what I'm looking for, but I want to understand the right way to do it and the reasoning behind it. My current theory is that Asin is expecting a Sin based on a unit triangle and that my input to it should be somehow normalized (probably not using the correct terminology). But I'm not really sure.... any ideas? thanks [edited by - jzela on May 20, 2004 11:44:38 PM]

##### Share on other sites
Sounds like you need to take the length between the front a rear axles into account.

B |\  A  |_\     C

With those sides labelled, we have B is the height different (what you calculated), and A is the length between the axles. You're looking for the angle between the two. Heard of SOHCAHTOA? It means Sin=Opp/Hyp, Cos=Adj/Hyp, Tan=Opp/Adj. In this case Hyp=A, Opp=B, and Adj=C, so:
sinθ=B/A
Thus: θ=asin(B/A)

I'm guessing you're magic number is very nearly 1/(distance between axles).

Hope that makes sense.

BTW: "My current theory is that Asin is expecting a Sin based on a unit triangle and that my input to it should be somehow normalized" is actually pretty close to the mark.

EDIT: Edits are fucking up my ASCII leetness.

[edited by - Doc on May 21, 2004 1:51:10 AM]

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634060
• Total Posts
3015300
×