Operator — Camera Movement Controller for 3D games

Background

Some time ago I wanted to make a walker game with an ironic story. But I wasn’t going to create level collision objects using cubes in the editor, you know how it is, so … [next sentences are flooded and unreadable] … thanks to @morgerion 's advice I decided to pass the array of dynamic light sources into the shader as the texture … [ink has faded over time] … because it’s great to have full control over the kinematic character and slow it down based on surface tilt … [page ripped out] … ok, but what if I want to make a cutscene like the UT 1999 intro?

Operator

This is a tweakable camera movement controller suitable for 3D games. It can help you smoothly control your character’s camera or make cinematic motion paths using checkpoints.

Showing your player the level by flying around and finish the flight by smooth attachment to the character — sounds like a classic use case.

Play HTML5 demo with flying like :helicopter: and following :blue_car: .

Features

  • Camera rotation and zooming by mouse controls.
  • External manual control by messages.
  • Following an object with avoiding obstacles.
  • Smart alignment to the ground slope.
  • Smooth movement along checkpoints using a bezier path.
  • Switching between multiple cameras.

Local space coordinates and rotations are respected so you can fly between two moving objects without problems.

Bonus

A wonderful bezier module with uniform position calculation comes as the bonus :grinning:.

Documentation

Full documentation is available in the GitHub repository .

27 Likes

Since I’m still not making my own game, I don’t have any real use cases yet. So, if there is anything I haven’t considered, or if something is sorely missing for your case, please write about it.

One of the questions I haven’t been able to answer yet is how to work better with cursor locking using pointer-lock extension by @aglitchman. Right now the behavior is based on the default settings of the extension, but a real game case would need manual control over cursor locking without action binding. I think about cursor locking via messages. But on the other hand, locking the cursor is not the responsibility of the camera controller. So I’m still thinking about it.

8 Likes

This is incredibly awesome!!! Good job!

Would be cool to make an ultra polished version of the demo with production level assets along with cast shadows / ssao / fxaa etc

8 Likes

Exactly! A Defold reel/show-off kind of thing! :open_mouth:

Amazing module @astrochili, thank you for sharing! :heart:

8 Likes

Thank you guys! :blush: The next extension in the ‘Make UT99’ series is coming soon, stay tuned.

9 Likes

Updated to 1.1! :partying_face:

  • The operator no longer attaches to the parent object when following, just following with positions syncing.
  • Removed operator.flight_zoom_easing because the camera zooming is handled by the bezier path now.
  • Refactoring, refactoring…

And I have a few questions that maybe someone can help me to figure out in.

How to animate the camera rotation more smoothly?

Right now it uses the quad in-out easing function by default. It’s also possible to set any custom easing function or some function included in the extension: operator.EASING_INOUT_SINE, operator.EASING_INOUT_CUBIC, etc. But none of them do a perfect rotation animation between motion points, and you can notice this in the demo.

A perfect result can still be achieved by fine-tuning checkpoint rotations and positions, placing more checkpoints in the middle. But it would be nice to do it more automatically.

At first sight, an euler value is the point with x y and z axes those represents angles. Having two euler values, it’s also possible to make a bezier path. But what should be the anchor points in this case?

Have some problems with moving in the collection 3d space in the editor.

At some moment I can’t get closer to the scene in the editor. I created an empty collection, added the same scene there and there the movement is adequate. What can it be?

14 Likes

You should be able to select one of the 3d game objects or models in the outline and then press the " F " key to move the view to an object which matches scale and position of the selected then you should be able to move around and zoom from there with ease. I believe it is a precision issue with zooming in or out from any fixed point and many 3d editing tools have the same problem, moving/centering the view to an object is the solution.

4 Likes

@MasterMind Really works, thanks!

4 Likes

Great job !

2 Likes

That’s a super camera controller, thank you!

There is a small glitch in this version: you renamed the “main” folder into “example” but forgot to change the paths and so get the corresponding error messages:

2 Likes

Thanks for the remark! Fixed in the last commit but without additional release in the hope that releases are used only as extensions links.

3 Likes

This hope is lost on me, I am flying right now through the project I downloaded, couldn’t wait to try it out, so cool!

3 Likes