WIP Character Controller Suitable for 1st/3rd Person Shooter

I’ve got a WIP character controller character controller that I wanted to share, it might need some work/cleanup, but it is the best thing that I have been able to produce so far that can walk up and down hills without speeding up, slowing down or jittering along the floor. It also lets you set a maximum slope that the player can walk up ( but it needs a little bit of work ). It probably needs Armory 0.6 to work right.

Thanks to @zaethan and everybody else from my math question post. The vector project math was used in the controller :slight_smile: .

10 Likes

Sweet! Once it’s ready we could bundle this into Armory, provided you would be ok with that. :stuck_out_tongue: Those old rusty ones that are bundled now should have been replaced long time ago…

4 Likes

Awesome! That’s just what I wanted to do. I’ll let you know when I have it ready. :smiley:

2 Likes

Yay, excited! Can’t wait to finally configure characters in Blender using @props. :hammer: :smiley:

1 Like

@zicklag Amazing work! thanks for sharing this, I will borrow the portion of code that sticks player to ground to use it in my game, thank god I don’t have to reinvent the wheel to do this :slight_smile:

1 Like

Awesome! I couldn’t belive that I couldn’t find any great Bullet examples when I tried to implement the controller ( I really only searched the Bullet forums, but still ). I had tried a whole bunch of different strategies before it seemed like this one worked. There are so many strange problems you run into when trying to do a basic character controller ( you should have seen when his head would stick to the ceiling when he jumped into it :wink: ).

I’m so glad that my example is helping somebody else out! :smiley:

2 Likes

Hey!
I could really use a character controller,
but TBH I don’t know how to set this up. :smile:
Any help appreciated!
Here’s the error after I apply the script to the character as a(n) Haxe trait:

Invalid commandline class : arm.CharacterController should be player.CharacterController

Haxe compiler error.
Finished in 1.963179111480713
Build failed, check console

Ah, that one’s easy. :smile: Just change the package player; at the top to package arm;.

huh.
I’m pretty sure that the character is supposed to move when I press the W A S D keys?
Is there anything I’m doing wrong?

I made a capsule, then parented a camera to it, and applied the script.

Is there any output in the console? I just ran a quick test with it, and I realized that the name of the class on line 12 was CharacterController2 not CharacterController. It doesn’t really matter what it is, but it needs to be the same as the name of the file, otherwise it will not apply the trait. That might be your issue.

BTW, something I forgot to mention, the controller actually only takes care of the walking movement of the character not counting rotation. The rotation of the character isn’t handled in the script because I had a simple node tree that would rotate the object according to mouse movement so that you could look around. It would be good to build all of the camera and rotation logic into this script eventually, I just haven’t had the time.

Fixed it! Thanks!
(why does the post have to be at least 20 chars?)

No problem, glad it’s working!

That’s just to keep people from spamming the thread with super short posts like smileys or :+1:'s when liking is more appropriate. The software has some restrictions like that that seem weird or overdone sometimes, but it does tend to help keep threads readable and productive, I think. :smile:

:wink: :+1:

… .

Hi Zicklag, I love the look of this node!

I’m just having trouble getting to appear in the add node list? I’ve added the uncompressed 'charactercontroller2.hx script into my ArmorySDK and also a library in the same folder as the blend files.
I’ve even tried changing the package to Armory in the script. Could you possibly help?

Thank you very much :grinning:

Hey @LeeMo, the reason you are having trouble getting this to pop up as a node is because it isn’t a node! :wink:

I just update the gist so the package is arm like it should be. After that change, you should be able to put it in your Sources/arm folder and then add it as a Haxe trait to your player object.

Even though it is a Haxe trait, you don’t need to write any Haxe to use it. You should just be able to apply it to your character and be able to move.

Now the script as it is kind of needs some extra logic nodes to make it fully controllable because the script has nothing to control the camera. Here is the node tree that I used to do that:

Tell me if you need any more reference for that. Essentially you just have to manage rotating the character and moving the camera yourself with nodes, while the character movement is handled by the player script.

2 Likes

Ah haha thank you :grinning:

This is great thank you. I needed to be able to lock the up and down rotation. Many thanks!

1 Like