154
edits
Changes
→Suggestions
** the calculations could be in the same place - Design::update() or in Camera::update() - probably better to keep them separate - add a query to Design to extract the angle into Camera::update() - it's up to you
** so the first step is getting the angle from the projectile's position
*** there is a formula for the angle between two vectors - it comes from the formula for dot product: a dot b = |a||b|cos theta ; use the acosf function in cmath
** second step is derive a special follower Camera class and add the logic there
*** build a prototype cube that simulates your camera to make sure that your math is right - then move the logic to the derived camera class
*** take a vector from mid-point to launch point and rotate it about the world Y axis through the same angle
*** this should give you the position of the camera
*** take a vector from that position to the projectile - that is your camera heading
*** take the vector perpendicular to the vector from the mid-point to the camera
*** the cross product of this vector and the heading is the top vector for your camera
** the calculations need only be done if the camera is the current one
** start with the transformation code in the Camera::update()