Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当我将disableFollowCam从新设置为false时,这时候相机会突然回到之前disableFollowCam设置为true时的位置,即使我在相机移动时已经将人物的位置设置到新的位置。 #121

Open
golden-fruit opened this issue Nov 5, 2024 · 2 comments

Comments

@golden-fruit
Copy link

这是我的代码:它实现在第一人称视角的镜头动画,将镜头移动到某个位置。我期望,之后不会再回到动画前的位置。它就呆在哪儿,可是
`
const rigidRef = useRef(null); // 玩家所在刚体
const [disable, setDisable] = useState(false);

// 相机移动
function cameraMoveTo(to: Vector3) {
if (!camera) return;
setDisable(true);
new TWEEN.Tween(camera.position, tweenGroup)
.to(
{
x: to.x,
y: to.y,
z: to.z,
},
1800
)
.easing(TWEEN.Easing.Quartic.InOut)
.start()
.onComplete(() => {
setDisable(false);
rigidRef.current!.setTranslation(to, false);
});
}

cameraMoveTo(new Vector3(0.5, 1, 6));

<Ecctrl
  // 人物设置
  position={startPos}
  camInitDir={START_DIR}
  maxVelLimit={SPEED} // 人物移动速度
  turnVelMultiplier={1}
  turnSpeed={100}
  name="player"
  // 相机设置
  camListenerTarget="document"
  camCollision={false}
  camInitDis={-0.01}
  camMinDis={-0.01}
  camMaxDis={-0.01}
  camLerpMult={1000}
  camFollowMult={1000}
  camUpLimit={Math.PI / 10}
  camLowLimit={-Math.PI / 10}
  // 移动设置
  mode="CameraBasedMovement"
  disableFollowCam={disable}
  autoBalance={false}
  floatHeight={0}
  ref={rigidRef}
/>`
@golden-fruit
Copy link
Author

貌似不是镜头跟随玩家,而是玩家跟随镜头,我能在disableFollowCam时更新followCamera的位置吗

@golden-fruit
Copy link
Author

record_2024-11-05.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant