Camera Position Movement Code

In this Scene 5 CoSpaces Edu :: Video Game Project, January 2025

we want the character to walk forward, but the character switches its orientation once you reach a diagonal line. How can we fix this?

Hi @Kelly_Nickell,

The problem is the “forever look at” code (it’s unnecessary) and the turn code.

If you want a camera to constantly look slightly in front of the person, simply turn the camera to look at that point in the editor. It will hold its gaze there because of the parent/child object relationship.

If you want the camera to turn correctly whilst tilted, you need a more advanced turn block, which allows you to set a local origin (pivot point) and a global direction (in this case, the global Z-axis).

I’ve also removed all the unnecessary events in forever loops (a common mistake). Tell your students to set their events at the beginning of the code, and then they are automatically set forever - no forever block needed.

Hope this helps! Let me know if you have any further questions. If it solves your students’ problem, please mark this post as the Solution.

Many thanks,
Geoff @ TechLeap