V
Vrok
Guest
Hello there, I'm new to this forum, and I entered here so I can look for answers.
So I'm working on an engine that allows the camera to move and rotate in many angles. I'm trying to make an object where its 'view coordinates' stay constant regardless of view angle, in other words, make the object move along the view angle, while its position 'appear constant' regardless of view angle.
Here's the code I put in:
x = view_xview + 640 - (640 - 64) * cos(degtorad(view_angle))
y = view_yview + 640 - (640 - 64) * cos(degtorad(view_angle))
Here're some images to give an idea what the problem's about:
(view_angle = 0)
The black ring represents the object I want to have it to remain in the same 'position' when the view angle changes. Don't mind the arrows; their x and y coordinates remain constant as I have to deal with the black ring first. And yes, the compass to origin angle should have been 'compass to center angle' in the first place.
(view_angle = 45)
This is the problem. Whenever the view angle is rotated, the position of the black ring changes, and does not remain on the same 'view coordinates' as the above picture.
(view_angle = 180)
Another screenshot of the problem.
Any idea how to fix the problem in the code?
So I'm working on an engine that allows the camera to move and rotate in many angles. I'm trying to make an object where its 'view coordinates' stay constant regardless of view angle, in other words, make the object move along the view angle, while its position 'appear constant' regardless of view angle.
Here's the code I put in:
x = view_xview + 640 - (640 - 64) * cos(degtorad(view_angle))
y = view_yview + 640 - (640 - 64) * cos(degtorad(view_angle))
Here're some images to give an idea what the problem's about:
(view_angle = 0)
The black ring represents the object I want to have it to remain in the same 'position' when the view angle changes. Don't mind the arrows; their x and y coordinates remain constant as I have to deal with the black ring first. And yes, the compass to origin angle should have been 'compass to center angle' in the first place.
(view_angle = 45)
This is the problem. Whenever the view angle is rotated, the position of the black ring changes, and does not remain on the same 'view coordinates' as the above picture.
(view_angle = 180)
Another screenshot of the problem.
Any idea how to fix the problem in the code?