[Released] Character Movement Fundamentals - A Rigidbody-based Character Controller

Hi everyone!

I’d like to introduce you to Character Movement Fundamentals, a rigidbody-based character movement system for Unity.

Put simply, it’s a collection of scripts, components and prefabs that will help you quickly set up characters that can move around and react to any 3D game environment in a physically believable way.

Everything in this package is designed to be as versatile and adaptable as possible - whether you’re creating a fast-paced first-person shooter, an atmospheric third-person adventure game or a 2.5D sidescoller, this package will provide all the necessary fundamentals you need.


Video Tutorials:
Adding Custom Animated Characters


Features:

- In-depth user manual*.*
- Fully documented source code.
- Versatile, highly customizable character controller system.
The included character controller can handle all kinds of terrain, smoothly walks up and down slopes and stairs without losing ground contact and can even slide down slopes that are too steep.

In addition to that, it can be rotated freely at runtime, allowing for
interesting gameplay possibilities (walking on ceilings or on a miniature planet […]).

To optimize your game for any type of platform, you can choose from three different ground detection methods.

Finally, all movement-related properties (movement speed, air control, jump speed, step height […]) can be adjusted to fit any type of gameplay.

- All-purpose camera system
The included camera system is well suited for any type of camera perspective (first-person, third-person, top-down […]) and features built-in camera rotation smoothing, invertible input axes and adjustable vertical camera angle limits.

- Two example scenes that showcase all the possibilities of the package.

- 12 ready-to-use controller prefabs*,* that can “drag’n’dropped” into any scene and just work, no further setup required.

- A collection of basic environment building blocks and a fully rigged and animated low-poly character model, both of which are great for quick prototyping.


If you have any questions about this asset and its playable demo or if you’d like to give me some feedback (which is always very much appreciated), please feel free to do so, either here in the forums or directly via email at support@j-ott.com*.*

Thanks for your time and have a great day!

  • Jan

5 Likes

this looks really well done, very versatile. 2 quick questions, would I be able to run 2 character controllers and cameras at the same time? and does the camera have a ability to zoom in/switch position?

Thanks p_hergott!

You can easily run multiple character controllers in the same scene! Here’s an example I just threw together:

4781525--456158--Splitscreen.png

For the split-screen effect, all you need to do is adjust the ‘Viewport Rect’ settings of the player cameras, which only takes a few seconds.

There’s no ‘zoom script’ included in the package (yet), but implementing a zoom function would be fairly easy. If you’re interested, just send a mail to support@j-ott.com and I’ll gladly help out with that.

Regarding switching camera positions, I’d need a bit more information about what you’re trying to do - do you want to have two characters in a scene sharing one camera (that can switch between these two characters) or something else entirely?

Well im 3/4 done a split screen xbox project. And the one thing i keep revisiting is the camera controller. For zoom, im thinking, for a over the should aim mode.

and can the camera target be set dynamically?
also while im asking hahaha, I see the controller has a jump, does it also have a sprint? (my controller im using I built myself, so doing minor modifiers and stuff shouldn’t be a problem.

haha I almost feel bad for all the questions, but I do truly like what I see though, looking through the images, video and manual. it really does look like an outstanding controller.

Thanks for the kind words!

Ah, now I get it! This kind of zooming/aiming can easily be implemented with this asset. It basically comes down to changing the camera’s offset and field-of-view a bit whenever the player is holding down the ‘aim down’ button.

As of right now (version 1.1), all cameras are child objects of the character controllers. However, since the whole system is very modular, you could easily make the camera its own independent gameobject and have it follow different targets dynamically.

Currently, there’s no sprint functionality implemented in the controllers (there could be in the future, if there’s enough interest in more advanced movement). The scripts are very adaptable though, so adding sprinting should be fairly straightforward, depending on how complex your sprinting system needs to be.

Like I said before, if you happen to run into any problems with the asset or need help implementing something specific, just feel free to contact me via the support email and I’ll try to answer in more detail.

I’m happy to announce that ‘Character Movement Fundamentals’ has just been upgraded to version 1.1. Here’s a list of the changes:

Version 1.1 changelog

  • Replaced old showcase scene with new version (now with a proper controller selection menu).
  • Polished controller prefab settings.
  • Replaced ‘ApplicationControl’ and ‘ChangeControllerType’ scripts with new ‘DemoMenu’ script, which will now handle switching between different controller prefabs.
  • Added ‘DisableShadows’, ‘FPSCounter’ and ‘PlayerData’ scripts, all of which are used in the new showcase scene.
  • Decreased scene light intensity to ‘0.7’.
  • Removed all (unnecessary) ‘Showcase’ controller prefabs, all example scenes now use the controller prefabs included in the project.
  • Added ‘MouseCursorLock’ script, which provides basic mouse cursor locking functionality. Old (unstable) ‘FocusMouse’ script was removed.
  • Updated user manual to reflect changes.

This update mostly consists of streamlining the showcase scene(s) and all included controller prefabs, but there’s also some new content in there (a proper mouse locking script, for example).

Hello,

concerning the top down view, is it possible to add click and point move ?

thanks.

Teq

There’s currently no “point-and-click” type controller included in the package. But it’s definitely possible to implement that kind of movement with this package by writing some custom movement logic.

I’ll definitely add a dedicated controller prefab for this in a future update if there’s a demand for it, though!

I can vouch for click to move for Top-Down, otherwise its an excellent product!

Hello.

Looks interesting, but can you tell me a bit more on how it is done? I assume it’s a kinematic not dynamic character controller so the interactions with dynamics are reconstructed my hand. i’m using a seesaw test to check if character controllers are suitable for me. would you be so kind and show me how it acts when the character jumps on a dynamic seesaw and with a heavy object falling on the other end while standing on it (and maybe one where he walks on an unstable physics object like a chain bridge)?

thanks

Well, seems like there is a demand, so I’ll be sure to sure to look into it for the next update!

Put very simply, the character movement system in this package is a combination of (dynamic) rigidbody physics and a raycast-based ground detection system to get the best of both worlds, so to speak.

Regarding your seesaw test: As of right now, this package is probably not the best choice for the type of environment interaction you’re looking for. By default, the controllers don’t exert any downwards force on the rigidbodies they’re standing on (which would be necessary for a seesaw to work). Likewise, the controllers don’t feature an inertia system yet (also necessary for the seesaw physics).

I can think of few ways to convincingly “fake” the physics interaction you’re looking for, but a 100% physics driven rigidbody controller might be a better choice here.

Hope that helps!

well no other character controller i tested so far passed this test so thats good info (for you, for me it means i need to keep searching :smile:)

making a dynamic rigidbody controller is a pain and i pretty much gave up already because the physics engine causes several bugs and without source code i cant adjust / fix it.

but oh well. good luck with your asset!

What sort of moving platforms does it support and how does it handle the orientation of moving platforms?

e.g. if I’m inside a school bus that is a physics based vehicle, can I walk around the inside of the bus, and what happens to character orientation when the bus is turning?

Currently, all included controller prefabs support kinematic rigidbody platforms that use trigger zones (trigger colliders) to determine if a character is standing on top of them. As of now, the orientation/rotation of the moving platform does not affect the rotation of the character standing on it.

I’m currently doing some tests to see if I can come up with a system that doesn’t require trigger zones and could also handle rotating the character at the same time. So far, I haven’t found a good solution yet, but I’ll keep at it.

That sounds like a tricky game mechanic to implement. Since the bus would need to be a dynamic rigidbody, this is currently not possible with this package.

Do you have an example of an existing game that implemented this mechanic successfully? I’d love to see this in action!

Hi there and thank you for you great product. I am using your first person prefab and would like to know if I can make the camera movement only happen when a mouse button is down instead of all the time as it does now?

I’d need the user to be able to move his mouse in the game without moving the view.

Many thanks and best wishes

Hi jh092!
That’s easily done! All you need to do is create a custom script, extend the CameraController script and override its GetInput() function. There’s also a chapter in the manual on this topic (4.4.2 - Overriding the Camera Controller, page 31), if you’re interested.

Check out the file I attached below called “CustomCameraController”: It’s a very basic example of how to implement that kind of camera behaviour. Just import it into your project and use it to replace the regular camera controller component in one of the prefabs (or you might want to create a new custom prefab first).

In the ‘FirstPersonWalker’, you’ll find the camera controller script under ‘FirstPersonWalker → CameraRoot → CameraControls’.

Side note: Make sure there’s only one camera controller script attached to the gameobject at the same time.

I hope that helps! If you have any further questions (or if anything’s not working correctly), please feel free to contact me via the support email (support@j-ott.com). Or just reply in this thread, both options work for me!

4851674–466850–CustomCameraController.cs (554 Bytes)

1 Like

Ah I see, thank you so much for the super fast response, this is exactly what I needed too.

John

Hi again, sorry I do have one more question if I may…

I’m trying to save the player position and rotation so that I can save and load my game levels, returning back to where I was.

I can save the position just using the FirstPersonWalker transform.position that’s fine, but my issue is with the rotation. I have tried many different things using the FirstPersonWalker/CameraRoot/CameraControls.transform.rotation but not having much success.

For rotation, on save I’m using:

CameraControls.transform.rotation.eulerAngles.x
CameraControls.transform.rotation.eulerAngles.y - 360

And then on load I’m using the SetCustomRotation with the above two values.

Looks like the y is correct but the x is always wrong…

Hope that all makes sense :slight_smile: