How to move camera from mouse movement?

Hi, I’m new to Armory and have been playing around with it a bit and was wondering how to make the camera move from a third-person perspective using the mouse movement as an input. So far all I can think of is parenting the camera to an empty for the pivot point and using the get mouse movement node to rotate the empty, but this causes some weird camera movement. Any suggestions?
(I’m on blender 2.83 and using the newest version of Armory also sorry for the question I can’t find any good tutorials.)
By the way, I’m not new to blender just Armory so I’ll understand the technical terms :).

Hi,

Parenting the camera to an empty and then rotating is the simplest way to do it, and it should work. Could you elaborate on the “weird movements”? If you mean the rotation is too fast, try using a Math node and multiply a small value to the mouse movements.

Best,
QC

2 Likes

Hi, in terms of weird movements, the camera does rotate too fast and I have tried to multiply by small number which does slow it down, but the camera continues to move in one singular direction (up toward the left).

Hi, in terms of weird movements, the camera does rotate too fast and I have tried to multiply by small number which does slow it down, but the camera continues to move in one singular direction (up toward the left).

In fact there is a weird bug in some node, but here is one example that should work after the bug is solved: untitled.blend (756.8 KB)

If you wish to clamp the vertical rotation: you would not need to store the rotation in a variable like i’ve done, it is just the way i think it is more clean, but you can just use Get Object Rotation and separate vector instead.

1 Like

I see. Thanks for the help. Quick question though: what about using the bundled ThirdPersonController script? Not sure how to use it. I managed to use the first person controller but got weird things popping up in front of the camera.

Update: I downloaded community made nodes and used the Camera Controller node, but still get weird lines and mirroring effects popping up in the camera view.

I also don’t know how to use it properly :slight_smile:

I think it is more for a demo because the script structure is a bit confuse for me to modify it, i personally prefer to build it from scratch and believe me it is not difficult and take less time than trying to figure out the whole thing.

I am focused now in finish another stuff, but here is a “dirty” third person controller that you can look into https://github.com/armory3d/armory/files/5649579/PlayerControl.zip

Some considerations:

  • It have some wrong way to do things that would be simpler, like “acceleration” and smooth rotation

  • Does not allow full control of physics like a kinematic character body (it is my personal taste to don’t use it)

  • If you feel it is unreadable i will clean it sometime

  • The animations are glitchy but this is because i imported it in the wrong way

1 Like

Thanks, I’ll try it out!

Hi,

Although a bit late, this I think is a little better solution. Use the mouse to orbit around and scroll wheel to zoom in/ out.

Hope this helps,

Best,
QC

TPPmovement.blend (780.7 KB)

3 Likes

This might be a stupid question but when I run it it says file not found a bunch of times.

Hmm, That’s strange. I was able to run it after downloading it again. Could you describe the error in a bit more detail. Like do you see a black screen and any warnings/errors in the blender console?

1 Like

This pops up in the console.
__________ [Armory] Compiling __________
Traceback (most recent call last):
File “D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\props_ui.py”, line 843, in execute
make.play()
File “D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\make.py”, line 500, in play
build(target=runtime_to_target(), is_play=True)
File “D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\make.py”, line 388, in build
export_data(fp, sdk_path)
File “D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\make.py”, line 97, in export_data
make_world.build()
File “D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\make_world.py”, line 30, in build
create_world_shaders(scene.world)
File “D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\make_world.py”, line 81, in create_world_shaders
make_shader.write_shader(rel_path, shader_context.vert, ‘vert’, world_name, ‘World’)
File “D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\material\make_shader.py”, line 143, in write_shader
with open(shader_path, ‘w’) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘D:/build_Orbit\compiled\Shaders/World_World.vert.glsl’

location: <unknown location>:-1

location: <unknown location>:-1
Error: Traceback (most recent call last):
  File "D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\props_ui.py", line 843, in execute
make.play()
  File "D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\make.py", line 500, in play
build(target=runtime_to_target(), is_play=True)
  File "D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\make.py", line 388, in build
export_data(fp, sdk_path)
  File "D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\make.py", line 97, in export_data
make_world.build()
  File "D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\make_world.py", line 30, in build
create_world_shaders(scene.world)
  File "D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\make_world.py", line 81, in create_world_shaders
make_shader.write_shader(rel_path, shader_context.vert, 'vert', world_name, 'World')
  File "D:\Blender\Other\Add Ons\ArmorySDK//armory/blender\arm\material\make_shader.py", line 143, in write_shader
with open(shader_path, 'w') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'D:/build_Orbit\\compiled\\Shaders/World_World.vert.glsl'

location: <unknown location>:-1
1 Like

Thanks,

I believe this is somehow related to World Shader. I can suggest 2 possible workarounds.

  1. Disable checkbox Blender >> Armory Render Path >> World >> Irradiance. If that does not work,

  2. Change Blender >> Armory Render Path >> World >> Background to “Clear”.

Please let me know if this works then.

1 Like

Nothing made a difference :neutral_face:

Hmm, Must be something else then…

Anyways, here is the web version of the same. Have a look.

1 Like

Thanks, it works in the browser. I’ll try remaking the nodes.
Sorry to bother you I’m just trying to get the hang of the engine.

2 Likes