Comments (5)
Here is the slow movement follow issue
...The very slow transition makes the game feel very slow and disconnected from the character:
from camera-controls.
Here is the "over rotating and lerping in the opposite direction of the mouse movement" issue:
And my camera rotation logic:
// in my camera constructor
document.addEventListener("mousemove", (event: MouseEvent) => {
if (VulpineMiscUtils.IsUndefinedOrNull(this._tagCamera)) return;
if (GameClient.PointerLock.PointerIsLocked() === true) {
const { movementX: horizontalMovement, movementY: verticalMovement } = event;
this._characterFollowLateralAngle += horizontalMovement * Config.Camera.MouseSensitivity;
this._characterFollowVerticalAngle += verticalMovement * Config.Camera.MouseSensitivity;
this._characterFollowVerticalAngle = VulpineMathUtils.Clamp(
this._characterFollowVerticalAngle,
VulpineMathUtils.DegToRads(Config.Camera.CameraPitchDegreesMin),
VulpineMathUtils.DegToRads(Config.Camera.CameraPitchDegreesMax)
);
});
// in my update loop
this._nextCameraLookDirection.x =
Math.cos(this._characterFollowLateralAngle - Math.PI / 2) * Math.cos(this._characterFollowVerticalAngle);
this._nextCameraLookDirection.y = Math.sin(this._characterFollowVerticalAngle);
this._nextCameraLookDirection.z =
Math.sin(this._characterFollowLateralAngle - Math.PI / 2) * Math.cos(this._characterFollowVerticalAngle);
this._nextCameraPosition.x =
this._followTargetObject!.position.x + this._nextCameraLookDirection.x * this._characterFollowDistance;
this._nextCameraPosition.y =
this._followTargetObject!.position.y + this._nextCameraLookDirection.y * this._characterFollowDistance;
this._nextCameraPosition.z =
this._followTargetObject!.position.z + this._nextCameraLookDirection.z * this._characterFollowDistance;
this._cameraControls.lerpLookAt(
this._currentCameraPosition.x,
this._currentCameraPosition.y,
this._currentCameraPosition.z,
this._lastKnownTargetPosition.x,
this._lastKnownTargetPosition.y,
this._lastKnownTargetPosition.z,
this._nextCameraPosition.x,
this._nextCameraPosition.y,
this._nextCameraPosition.z,
this._followTargetObject!.position.x,
this._followTargetObject!.position.y + this.cameraLookAtVerticalOffset,
this._followTargetObject!.position.z,
10,
true
);
this._currentCameraLookDirection.copy(this._nextCameraLookDirection);
this._currentCameraPosition.copy(this._nextCameraPosition);
this._lastKnownTargetPosition.copy(this._followTargetObject!.position);
this._cameraControls.update(deltaTimeS);
from camera-controls.
Thanks for using camera-controls.
To solve that delay, you can set 0
to the smoothness value
cameraControlsInstance.smoothTime = 0;
cameraControlsInstance.draggingSmoothTime = 0;
Also, check the third-person demo in the example section and the docs for further information.
from camera-controls.
Thank you @yomotsu ! Your library is wonderful and I'm enjoying using it.
I have sped up the lerp speed using the parameters you describe above.
I solved my other problem - the over-rotation - by capping how much the camera is allowed to rotate each frame :)
5月にあなたの美しい国に旅行します! 長野と山梨の地域でハイキングする予定です。 あなたの文化と景色を体験することを楽しみにしています。
camera-controls
に再び感謝します!
from camera-controls.
It's good to hear that.
May is one of the best months to visit! Altho, temperatures have been on the rise in recent years.
(My parents in law live in 山梨 btw...)
いい旅を。
let me close the issue then.
from camera-controls.
Related Issues (20)
- Invalid "main" entry in v2.8.x HOT 10
- Add focus function HOT 7
- Error 'ThreeCameraControls.install is not a function' HOT 2
- Method to cancel ongoing transitions HOT 5
- Mouse wheel zoom doesn't work with pressed Shift on Mac HOT 1
- The automated release is failing 🚨 HOT 1
- Update three.js version to 162 HOT 2
- Not update in worker HOT 5
- Dolly to Cursor and focalOffset HOT 5
- I want to replace camera-controls with the default controls in my project, here is an example, how can I do it to be compatible correctly? HOT 2
- fitToBox on a plane: how to prevent plane to get perpendicular to view? HOT 1
- Dolly to cursor reaches limit HOT 4
- Dolly to cursor does not maintain steady speed
- Roll/tilt control HOT 1
- Can't zoom after switching between cameras HOT 10
- Cannot dispatch custom event HOT 4
- It would be nice to have setFov method with smooth transition
- Transition updateCameraUp HOT 1
- Control functions skip frames when frameloop = demand HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from camera-controls.