Third person character controller

It’s the mighty McCurdy himself! :smiley: Thanks for giving feedback, really appreciate it.

I guess it’s a matter of taste. I too find Heraclos’ and Plume’s movement quite sluggish, but I’m quite happy with my controller. I intentionally added velocity easing to complement the animations. It’s no problem to make it more responsive, or even as responsive as your example.

In the end, with a system like mine, you have complete control over how responsive the system is. The vast majority of the movement is custom logic. I only leave things like gravity to the engine, but adjust all the calculated velocities to my liking. My movement is basically physics engine agnostic. I can do with any engine that offers raycasting and rigid body collisions. I actually switched from Ammo to Cannon because I found Ammo to be lacking quite a bit in bunch of areas.

It’s a matter of tweaking the parameters to get the behavior that you like. I’ve read that people find the movement in Read Dead Redemption 2 sluggish and frustrating, whereas I find it beautifully fluid and wouldn’t expect anything else from a Rockstar games title. So again, really seems like matter of taste. And in my case, overly sluggish movement would really be a fault on my part and nothing to do with the physics engine.

To be honest I’ve never even considered purely nav-mesh controls. I definitely think of nav-mesh logic as something that builds on top of physics based character controller. In fact it’s on my todo list to try and implement the amazing three-pathfinding in my demo. :slightly_smiling_face:

A physics based controller is necessary if you’re building a game like GTA, and want to make sure that your character will behave fine in any situation, moving on top of, or colliding with any kind of geometry imaginable, moving on top of dynamic entities like cars, and even do things like climbing, swimming, etc. It’s a general way to define character behavior. The next step would be to implement nav-mesh pathfinding to aid the AI in moving around.

I think your example would be useful for a walking-simulator type of game, like The Witness. But it does seem very restrictive in that I can’t go anywhere beyond the nav-mesh defined by the level designer. Still, enough for some games.


great demo, really impressive.

I evaluated a few different physics engines for JS a while back, including cannon. I came to the conclusion that “Ain’t Making My Own”.js is the serious option, the rest are just too weak. I also wrote a character controller a while back, it was fairly similar to yours - capsule, using forces, built on ammo.


Can definitely see where you’d want to use physics for a game with vehicles, yeah.

For dynamic obstacles, climbing, and swimming — I’m confident you can do most of that with a navigation mesh too. Libraries like Recast have neat features that I’ve been wanting to explore that alongside three-pathfinding. Whether that’s easier or better in any way than using physics for the same things, I have no idea. :slight_smile: With the Blender 2.80 (temporarily?) not having navmesh-creation features, that workflow has become a bit less convenient for sure…

If you get around to it i’d be curious to see a demo with the players’ acceleration/deceleration cranked up, or I may try that out when time allows. Thanks again for the demo!


I’d be interested to see more complex behavior with your purely nav-mesh controls. I just went off GTA 3, which I’m essentially copying in my demo, because it seems like Rockstar have figured out a good general approach to character movement many years ago.

Here’s maxed out spring acceleration:
You can still feel the springiness in this one which is kind of annoying. We could get rid of that by implementing something like lerp smoothing, instead of springs. Again, you can treat the velocities any way you like.

And here’s no smoothing at all:

The point of smoothing is really just to give the character sense of weight, and have more natural movement. And of course, animations play a big role as well. A different animation set with a more agile character would probably make it feel completely different.


A colleague and I have developed for Yuka a navigation mesh implementation that I’d like to share at this place. It performs merging of convex regions and also uses a spatial index to improve performance. Besides, it’s also possible to use it with Yuka’s task mechanism based on window.requestIdleCallback() in order to distribute computational work over multiple frames.

This is still work in progress but we already use it in many demos.

Of course you can also use the navmesh to restrict the movement of game entities and the player like demonstrated in this First-Person demo:


@swifterik Thanks! The “maxed out spring acceleration” example feels good to me, I guess it’s just different expectation/perception after all. :grin: The “no smoothing” example feels very responsive, too, but the instant character turning throws the feeling off a bit.

@Mugen87 that’s very cool! And quite a broad API! I haven’t seen many game-related libraries for WebGL libraries and have wondered why that is. Will be exciting to see more complex AI behavior on the web in the future. :slightly_smiling_face: I spent some time trying to get Recast/Detour compiled to WASM, and some Mozilla engineers actually got that working I think, too.


Great, I like it a lot.
If you do not mind, I’d like to get inspired.
It’s a good job.

Sure be my guest :slightly_smiling_face:
I’ll be happy to help you if you have any questions on how anything works…

Pretty sweet controller and handling!
Do I get this right, this is kind of a sandbox framework free to use for building games?
Your backlog looks quite ambitious, any plans on also adding First Person Camera?


I’d love for it to be a framework for games, but that’s a little too ambitious, since I’m just one guy working on this in my spare time. :slight_smile:

The original idea was to get a web based app in which I could showcase my 3D characters on the web. (Something like your showcasev3) I think that capability is present now.

As I went along, I realised I could easily go further, and the first milestone I’m trying to achieve now is a basic GTA clone, with vehicles and simple melee combat.

I don’t currently have any plans for first person controller. I guess it could easily be implemented, especially if we didn’t care about third person characters animations while you’re in first person, but even that could be set up with some work. It’s just not a priority.

I really enjoyed your threejs-fps. We seem to be interested in similar things when it comes to three.js. :slight_smile:


I love this project!

I wanted to play around with it but, being kind of a noob, I still haven´t figured out how to set the rigid bodies from blender. What is your workflow?

I just wanted to start creating a couple of shapes and walk around them. Is blender (2.80) gLTF exporter enough?


For any noob like me: Blender, add custom properties, check glTF export settings.

For example:
physics - trimesh
visible - true

Oh sorry for not responding.

My specific solution to this was to tag stuff in Blender or the three.js online editor. But that’s really just a dirty temporary solution, and it’s not a part of the Sketchbook at all. I’d welcome any suggestions on how to improve / simplify this process.

But I’ll get to work on Sketchbook in a few months again, currently I’m working on graphics for it.
I’m happy to hear you’re interested though. I’d be happy to see your experiments and help you with any problems you enconter. Just keep in mind that Sketchbook is a heavy work in progress and not ready for much right now.

Cheers. :slight_smile:

Thanks! I will surely do so! Right now I am really just playing around with the basics, first and foremost I am planning to get used to sculpt some objects in blender and explore them in your environment. What I like the most as for now is the simplicity of your setup, it just works and it is fun to use.

1 Like

Find the treasure.I like it,thank you very much :sweat_smile:

1 Like

Awesome job swifterik! Thank you also to set it up for open source. I am watching your repo and I am happy to see further processes to this project.

1 Like

Glad you like my project. I may not do a lot of work in the near future, as I’m working on my website, but hopefully I’ll come back to the project one day. I accept pull requests should you want to contribute. :slight_smile:

Also, this post is quite old, I’ve made a couple of posts since this one.


Thank you for the newer posts to this topic. I am happy that you accept pr contributions to your project. I will try in my free time to support your project. Maybe someone else asked already before, why did you choose the name Sketchbook? It’s remind me a little bit on the webdesign software Sketch :slight_smile:

1 Like

That would be awesome if you contributed. I keep GitHub projects with my personal todo lists if you wanted to see what I plan to implement in an indeterminate future. Projects · swift502/Sketchbook · GitHub
But a lot of those tasks are very specific and boring maintenance stuff, so obviously feel free to contribute whatever you want.

I haven’t heard of Sketch before. The project is called Sketchbook because it has no purpose and really no specific final vision. It’s just my playground to do cool programming experiments. I considered names like “Playground” and “Sandbox”, but Sketchbook felt the best and was an available name on npm. (though having the project as an npm package doesn’t even make much sense now…)
It’s not a great name, but it was the best term I could come up with to describe a direction-less playground for programming experiments, especially since I also create all the 3D graphics myself, so it’s somewhat of an artistic endeavor for me. :slightly_smiling_face:



I and my daughters often play your game and it’s often the occasion of a good laugh with them :slight_smile:

Especially when we try to take the plane on the “mega ramp” and that without making express we involve it in our race with us …