Using the combination of ‘Player Controller’ and ‘Camera Controller’ community made logic nodes, I have managed to get the camera control in a fly through style. However I’m just struggling with the back and forward movement.
Currently forward and back keys - mapped to ‘w’ and ‘s’ on keyboard are taking me in the z axis - up and down in the terrain model I’ve loaded. how would I get this to be on the flat x,y axis?
That Controller is actually moving you along the local x and y axis of your camera… the problem is that the local y axis of a camera is pointing upwards and it’s z axis is pointing forward…
So you actually want to move on the cameras z axis with w and s and move on the x axis with a and d.
This is something the Player Controller cannot do since it assumes that you move on the x and y axis.
May I suggest this as an alternative setup for your movement?
Genius - thank you so much zaethan, so I now have the below setup adding mouse middle button for look about, which is working well for flying around a terrain model.
However the only thing that seems troubling is that when you press middle mouse and try and rotate to start to look behind you it flips out and resets, as if it can’t cope going further than a 180 degree forward sweep?
I guess the issue is caused by the first object slot in the camera controller. If an object slot is left empty, armory will use the object that you assigned the tree to.
I guess you assigned the tree to the camera. Thus it behaves as if you assigned the camera to both slots.
Try the following setup:
add an empty into your scene
place it exactly where the camera is
parent the camera to the empty
assign the empty into the first slot of the camera controller
I just noticed that this setup will only move the camera, not the empty… You could add a set location node to always place the empty in the camera’s location. This would probably make it work, but it’s not a nice solution. At the moment, I don’t even know of any specific reason why the camera controller needs two inputs…
I mean, I know why I added it back then, but now I think it could be done with only one object input.
I will have another look at this tomorrow.
The first part multiplies the mouse movement with a small (and negative) number to scale it down.
The “rotate left right” section uses the z axis as rotation axis and the x value as angle to make the camera look left and right.
The “rotate up down” section uses the ‘vector from transform’ node to get a vector facing to the “right” of the camera which will be used as the rotation axis for looking up and down. It then uses the y value as angle.
I also added mouse locks so one can move the mouse infinitely without hitting any border (I don’t know whether locking currently works in the browser though)
This is a weird error, but I think I was able to fix it (just by moving some code around).
PR is here https://github.com/armory3d/armory/pull/1271
I say “I think” because I am still confused that this only happens on exported builds…