Isolating Camera Movement Controls from Camera Rotation Controls

Greetings! We’ve been using the Babylon Universal Camera which is a fantastic “out of the box” Camera, but we’ve been struggling to do a few things with it now that we are implementing a more complex user avatar rig/setup.

What we are used to doing is having a rig be the parent of the camera, and then having some movement controls on the rig while the camera just controls rotation. That way, we can easily have a button that stays directly below the user when they look down at their feet, by attaching a button to the rig that moves with the user, but which doesn’t rotate with the camera as the user looks around.

Is there any way to disable the movement controls entirely on the Universal Camera, and then even better, extract the movement controls logic from the Universal Camera and apply it to the movement of a non-camera entity? I know there are some playgrounds out there that lay out decent movement controls, but none seem quite as robust as the ones that come with Universal Camera.

Thanks for any help,

Gabe

1 Like

Adding @PolygonalSun for inputs and camera.

@PolygonalSun you are a celebrity today :slight_smile:

2 Likes

Hey @gabrieljbaker, if I’m understanding correctly, you’d like to remove any controls/movement from the camera itself and have it controlled by your rig in a way that matches or emulates how the camera moves itself. Is that correct?

1 Like

That’s correct, yep! @PolygonalSun . I’d still like the camera to be able to rotate on its own. Think like a head on a body. Head can rotate, body can move.

-Gabe

If it’s just the Arrow movement controls, you should be able to just disable the keyboard controls.

For example, assuming that you’re using something like camera.attachControls(), you could just remove them with:

camera.inputs.removeByType("FreeCameraKeyboardMoveInput");

This should allow you to retain the rotation controls but prevent the camera from moving when you do anything with the keyboard.

Is this in the vein of what you’re looking for?

1 Like

This is a good first step @PolygonalSun, thanks! Then, in a dream world I could even sort of use the movement controls found in the Universal Camera but apply them to the parent of the camera instead of the camera object itself. Maybe that’s a matter of me digging into the Universal Camera code and extracting some logic, so just wanted to check if you can think of any other route or know of other wasd/arrow key movement controls that are as solid as those. We could also home-grow our own if need be, but just wanted to check first on the above.

-Gabe