Third person camera with orbitcontrols

Hi,
I’ve searched the web for weeks now with no success and I’m hoping someone here can help me. I can get a normal camera(without orbitcontrols) to work, but once I add orbitControls, it seems the camera distances away from the moving object after rotating the object. Furthermore, adding an offset creates a situation where the camera no longer looks at the character.

The desired result I’m looking for is to keep the camera around the target, allow the target to move and yet still follow. whenever I’d like to orbit around the target, I should be able to without the camera moving further away. here’s the link for those who may be curious to the errors I speak of: hopeful-water-2slm53 - CodeSandbox

tldr: I’m trying to have a camera work similar to this: https://player-controller-henryegloff.vercel.app/

I think Orbit controls is the wrong tool for the job.

You should check the documentation that comes with the example that you want to replicate.

But, if you want to create a follow cam manually, you can create some kind of pivot mechanism, add the camera to it, and then add the pivot to the object that you want to follow.
One of my examples : Ball-VR
The mouse middle wheel modifies distance.
Mouse move, modifies the rotation of the pivot.

I didnt see any documentation to the example.

Creating a pivot point sounds like a great idea. Im not entiredly sure on how to even begin, but thanks for the suggestion. I’ll try to implement that.

I couldn’t find the docs for your example either. I saw it once before and presumed it had a GitHub page.

Anyway, here is a simple pivot example.
Capsule Follow Cam : https://codepen.io/seanwasere/pen/BaMBoPd
image

Also, look at this new project GitHub - pmndrs/ecctrl: 🕹️ A floating rigibody character controller
It is written very well.

2 Likes