Player Controller/Timer Nodes

Hello,

I have written some custom nodes which I think might be quite useful.

Two of them are player related. I made these, because I didn’t know about the bundled script at first. Even after finding out about the script, I thought it would be easier (at least for me) to be able to manipulate the settings on the fly in the node editor or add additional logic as I did not see an easy way to do that with the script.

  • The first node is taking a player and camera object and several inputs to control the objects as desired. For this node I have taken a lot of inspiration from the Translate On Local Axis node and the Look node. Although I called it “First Person Controller” it actually proved itself suitable as a third person controller.

  • The second just restricts movement along an axis to a minimum and maxium coordinate (it kind of reminds me of games like Little Big Planet or these endless runners where you only have some sort of tunnel to move in).import

  • The third is a timer as described here (https://github.com/armory3d/armory/issues/612), for which I have looked at the original On Timer node’s implementation.

What do you think, are these nodes useful? If so I would gladly contribute them… But I don’t really know how to do that. As far as I’ve seen, the standard procedure is to fork, edit and create a pull request. But aside from the main armory repository there also is the logic_pack, so I don’t even know which repository to contribute to.

14 Likes

This is amazing!! I think the fps controller node should be in logic_pack, no other engines I know of have such an easy FPS controller right built in. The other two seem handy in lots of different scenarios so maybe put them into official Armory (?).

2 Likes

:star_struck: What a community!

2 Likes

So far I have created a pull request for the FPS Controller.

And I adjusted the restriction node a little to make use of a dropdown instead of three booleansScreenshot_20180524_145634

But still I am not quite sure what to do with these two nodes… For now I will try to figure out where I have to put them in the armory sdk to make them work ^^

1 Like

Complete awesomeness, thanks for sharing!

Maybe we can iterate on the First/Third Person Controller node design and eventually move it into the main Armory as well? Wouldn’t it be desirable to have an easy node-based FPS controller built-in?

4 Likes

I would be honoured if it would be included in the main Armory at some point :grinning:

About its design: I have to admit that it seems kind of bloated with its 28 inputs… I was thinking whether I could split it up into two nodes. A Character Controller for movement and a Camera Controller.
However the camera controller would also require the player object as well as the camera object, as horizontal rotation is applied through the player object, which seemed kind of counter intuitive to me.

Although thinking about it, this is probably the better way to do it as it decreases the nodes size as well as enabling a potential developer more control over what he actually wants. Some games just do not need either a camera or player movement.

I will look into making these two nodes :grinning:

3 Likes

awesome work i think is better to separate them and can you add crouch state and option for attack or defense also is possible to add animations . ?

So it was actually quite easy to seperate it into two nodes


I also added a crouch modifier ^^ Although I think this might be a bit redundant. It should be possible to use a Float Array/multiple float nodes and just select one of them based on which key has been pressed and then insert that value into then run multiplier. However this would just make the setup somewhat more complicated again.

As for animations, I will look into it. but I have to admit I am not quite shure whether they actually should be in this node as it could make it kind of bloated again, just like with the camera controls.
As for Attack/Defense I think it might be better to put these in a new node like PlayerInteraction or something so you don’t mix it with the basic movements. I would happily create such a node as it would make setting up a character even easier, but I cannot really imagine what it would do :thinking: I could make it fire a raycast and return the object that was hit as well as playing an animation (if something was hit)…

EDIT: Just created a new pull request for the seperated nodes.

3 Likes

I found the first person controller on the gethub and downloaded it into the armory logicnodes folder. How do I get at it in Blender?

you can add input from each state for animation.Thanks for the crouch .I wonder crouch state will work only if we push the button down .Can you add on,off state for the crouch ? And plus button to add animation if you want or event for attack and defense .I hope that make sense

For custom nodes like this there is no need to actually copy something into the Armory sdk files. You only need to create a “Libraries” folder in the same directory where your .blend file is. In there you can either download and unpack the github logicpack repository or use git clone. You should then have a file structure like this

In this case TestBlend is the folder where my .blend file is located. If you only want the fpscontroller (In the screenshot you cannot see it because I already seperated it into the Player/CameraController) you can delete the other files if you want, but you would have to remove their entries from the blender.py aswell. So the easier way is to just keep them as well :grinning:
Restarting blender afterwards should allow you to access the new nodes. I have paced the FPSController/Player/CameraController in the action category.

Made a little video for the placement a while ago when the IRC was still active https://www.youtube.com/watch?v=Gtuie9gp8Nc hope it helps too

Did you think of something like this?


There is no actual logic behind these yet. I just modified the appearance of the node.

As for additional events (attack/defense), it might be possible to add something like what the array nodes use.image. These could then add a new boolean/animation pair which could then be used to trigger an attack animation if for example the left mouse button has been clicked.

However the same behaviour could probably be achieved more easily like this?image
I also have to admit that I have not yet worked with animating anything, so I might have gotten this all wrong :sweat_smile:

It need animation blend option.You can use ready animation from mixamo for testing

I’m kinda liking this, if you could get it to work. I think the ability to add more events would be great.

What would be the best way to build a locomotion system for the player controller? Using rigid bodies, inverse kinematics /constraints ect or would it need to be coded by modifying the haxe script (or is it possible using nodes). The reason I ask is because I am currently learning rust, and I dont want to get confused learning also haxe at the same time.

I am getting the movement to work fine but not the camera. Can you explain why you are using an empty to represent the camera and how you have the player model and the camera set up (parenting etc)

Thanks

Edit[I got it to work but still would appreciate knowing how you set up your example]

Oh, my setup, of course.

  • For a first person view a player object and a camera where its head would be is enough. The camera would then be parented to the player object.

  • For a third person view (I use this one for testing) you need to add an empty where the head is and parent it to the player. Then add a camera somewhere behind the player where you want it to be and parent it to the empty. In the node you then need to set the empty as “camera”. In the screenshot I moved the empty a little to the side so one can see the parenting lines. The cone is my player.

As for the animations: I played around a little and could get my cone to wobble up and down when I move forward and rotate fast when I move left/right by parenting it to another, invisible, object which I would then use as a player. However when walking forward and left/right only one animation played… Is this intended or did I miss something? I thought maybe they would overlap each other and I would a bouncing and rotating cone. I also tried deforming a cylinder with an armature in multiple ways in different animations and it was the same. Only one animation played…

1 Like

So despite me being unable to get my head around animations so far, I tried to think of what such a node could look like and how it could work. I would then split off this node from the others so we have one node for movement, one for camera and one for animation.


(there is no logic behind this yet but i guess it would be nothing more than copy pasting the play animation node a few times and adding a little bit of logic to it)

By default it contains an activation socket, a socket for the animated object, a socket for an idle animation (which implies that there is one…) and a socket for its blend time.

Just like with the array nodes one can then add new sockets for more animations and their blend times as well as their activation status using the buttons. I would have liked to just have one button which adds all three at a time but I don’t know whether that is possible…

If any animation would then be activated using the bools it would play that animation (just like the play action node) and would go back to playing the idle animation if no other animations are activated.
If multiple animations are activated at the same time it would then choose the one with the highest priority and only play that (still assuming one can play only one animation at a time…). Priority would then be like “from top to bottom” or vice versa…
So if I walk forward+left and forward has the higher priority only forward will be played…

As for the nodes output: Should it fire everytime the node it activated or only if it playes something else than the Idle animation? I could also add an output for the currently played animation…

Does this sound alright or did I miss something?

By the way I have also taken care of the “Hold for crouch” option. If it is activated the crouch will be applied as long as the key is being pressed. If not it will toggle the crouch state each time the key begins being pressed down so you can release it afterwards.

Also thinking of adding a modifier for the camera speed for something like a “precision” mode.The node fires an output if any animation

1 Like

This sounds like a very very good start. I can imagine we may find some issues and different use cased in the future that would need tweeking but this should get the ball rolling nicely. I too am trying to figure out exactly how actions fit into the whole thing now. Thanks for all your work on this.

Monte