-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
suggestionExternal ideas/inspirationExternal ideas/inspiration
Description
Hiya, Sajji here
Some theoretical camera rotation implementation I haven't tested yet:
x = cos(angle) * x + -sin(angle) * y
y = sin(angle) * x + cos(angle) * y
note: angle is in radians, may want to use a math function version that uses degrees
This math should rotate a point around the focal point of the camera/viewplane.
I believe it would do so around the horizon, but I'm not sure.
The psuedo implementation I wrote up:
- Intercept the projected road points before the polygon is rendered to the projection
- Convert projected road points to coord pairs via a non mutating method
- Apply the rotation math to the (x, y) pairs
- Return the new points as an array
- spread the array to the draw function
If that works how I think, it should rotate the road by whatever amount you want.
To finish the implementation, you'd also have to rotate the coords and angle of the sprites and adjust the rotation of the background elements.
Anyway, that's the current results of my Camera math research
Metadata
Metadata
Assignees
Labels
suggestionExternal ideas/inspirationExternal ideas/inspiration