Third peson character control with logic nodes

How can I use nodes to control a character (this is a normal capsule) and a rotating camera? The character should not walk backwards, but rotate 360 degrees relative to the camera.

Hi,
welcome on Armory forum :slight_smile:

Could you have a look at this topic, and try the example on the last post, I think it’s a good starting point : How to avoid camera going through rigid bodies?

I did the character control and camera rotation, but I can’t limit the vertical rotation of the mouse, and the character is still looking at the camera with his back. In the example that you have given, everything is too cumbersome. Is there an easier option? My project is attached.

untitled.blend (963.2 KB)

I managed to limit the rotation of the camera. But I still don’t understand how to rotate the character relative to the camera. I am guessing that this is about local axes.

The best way i found to limit vertical rotation is by using the Math node with ‘modulo’. You just have to put the rotation value in a Math modulo node with the limit value in radians. Modulo will keep the value inside the limit range. For example if you put the value input in a 2.5 modulo, the value will always be between -2.5 and 2.5.

To set the player rotation according to the camera there is various ways, the easier is to add the camera rotation to the player.

If you need more context or a .blend, i will try to explain better

I just checked the “Restrict vertical” box, and put in -0.500 and 0.500. But regarding the rotation of the character, the Blend file is probably better.

To make the player rotate according to the camera position, you just need to add the rotation value of the camera to the player and the addional rotation you want the player rotate. The problem is that you can’t get the camera rotation properly in Armory due to wrong values. A workaround here is to you store the rotation into a variable before you apply it to the camera:

https://github.com/armory3d/armory/files/5080962/untitled.zip - rotate the camera for where you want and press S to make the player turn back

But due to the lack of vertex parent, it is not a good idea having headache in a 3rd game for now. It will not be an easy work. I am trying to make a logic node based 3rd template with rotation interpolation, i will share it if i have some success on this :+1:

Here is what i have until now: https://github.com/armory3d/armory/files/5074806/Test4.zip