-3

I have a Vector3 which representing the position of my car. This direction is in 3D even if the direction is always in in the XY plane, so only the yaw value is changing.

Now, I want to add a pitch value in my model. I do have the pitch value but I can't figure out how to get the new coordinate of the direction in 3D.

So, I know OB vector and I want OA vector when I have ß angle.

I hope I've been clear.

Rory Daulton
  • 21,934
  • 6
  • 42
  • 50
tony497
  • 360
  • 1
  • 3
  • 15
  • see [Understanding 4x4 homogenous transform matrices](https://stackoverflow.com/a/28084380/2521214) and once grasped see the last 3 links in there on how to achieve a car control by matrices ... – Spektre Oct 01 '18 at 10:21

1 Answers1

0

Edit:
Seems I overcomplicated the problem (while previously written transformations should give the same result).

Get R as vector length

x = R * Cos(Pitch) * Cos(Yaw)
y = R * Cos(Pitch) * Sin(Yaw)
z = R * Sin(Pitch)

(note that pitch trig functions differ from spherical coordinates expression - there theta is measured from Z-axis)

MBo
  • 77,366
  • 5
  • 53
  • 86
  • @Spektre Why? Formula is general and it is not connected with OB directly. But fact that OB lies in OXY allows to apply it easily (just adding pitch) – MBo Oct 01 '18 at 10:32
  • You're right I overlooked the `yaw` circle in the equation... today I am somewhat absent minded ... highest time to stop working but still need to prepare some AVR32 code :( – Spektre Oct 01 '18 at 11:41