Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(MoveCameraTowards) Следование камеры за объектом #7

Open
mchernigin opened this issue Apr 1, 2024 · 0 comments · May be fixed by #39
Open

(MoveCameraTowards) Следование камеры за объектом #7

mchernigin opened this issue Apr 1, 2024 · 0 comments · May be fixed by #39
Assignees

Comments

@mchernigin
Copy link
Member

Эта функция вызывается каждый кадр игры. Необходимо, чтобы камера следовала за объектом obj с некоторым запозданием. Для этого нужно вычислить вектор, по которому движется камера с помощью полей obj.position и ctx.camera_pos и сделать так, чтобы поле ctx.camera_pos передвигалась с некоторой скоростью вдоль этого вектора. Так как скорость указывается в метрах в секунду, а функция вызывается чаще, чем раз в секунду, необходимо изменять позицию камеры только на то расстояние, которое она могла пройти после предыдущего вызова функции. Время прошедшее с прошлого вызова передаётся в параметре dt.

@mchernigin mchernigin converted this from a draft issue Apr 1, 2024
@vasthecat vasthecat moved this to Todo in MIT Game 2024 [1] Apr 11, 2024
@Lifilim Lifilim removed the status in MIT Game 2024 [1] May 28, 2024
@Lifilim Lifilim moved this to Todo in MIT Game 2024 [1] May 28, 2024
@TsoyIgor17 TsoyIgor17 self-assigned this May 29, 2024
@TsoyIgor17 TsoyIgor17 moved this from Todo to In Progress in MIT Game 2024 [1] May 29, 2024
@TsoyIgor17 TsoyIgor17 linked a pull request May 29, 2024 that will close this issue
@TsoyIgor17 TsoyIgor17 moved this from In Progress to Done in MIT Game 2024 [1] May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants