pmndrs / ecctrl

🕹️ A floating rigibody character controller
MIT License
547 stars 64 forks source link

What's the best way to offset the camera to the side #100

Open hichemfantar opened 1 month ago

hichemfantar commented 1 month ago

i'm trying to have an aim crosshair but that doen't work when the character in the middle of the screen.

what's the recommended approach to push the camera to the side in ecctrl.

example:

maxresdefault

edit: i managed to get a close result by setting camTargetPos={{ x: 1, y: 1, z: 0 }} but it's not consistent when i move the camera.

example:

https://github.com/user-attachments/assets/ca71d82e-7dfa-4845-a1a5-cfa47b216ca1

video example of the desired camera behavior while rotating

https://github.com/user-attachments/assets/e3d28d37-b390-401f-a045-408f2003e89e

ErdongChen-Andrew commented 1 month ago

Currently it only works with the world axis. Will fix this in a future version.