Con*_*sed 5 dynamic unity-game-engine cinemachine
我找不到如何根据英雄的速度和身高不断地动态地在3台摄像机(我称它们为中,上,下)之间动态融合的方法。
当跟随英雄时,中间的vCam是主要/基础的,我想根据英雄的高度按比例地混合上下vCam。
播放器/英雄可以在不同高度之间快速移动,因此应轻松地对混合进行加权。这是Cinemachine混合的自然组成部分。和工程。但是,就我目前对Cinemachine混合的了解而言,这就像是一个开关,而不是基于高度的恒定动态混合。
您可以考虑移除上部和下部摄像头,并仅使用中间摄像头进行自己的“手动混合”。最近我一直在使用 Cinemachine,我做了一些与您想要的结果类似的事情。
\n\n由于我不太清楚您希望相机如何表现,因此我向您展示了我所做的一些手动混合,并解释道:
\n\n//Camera Direction\n//If I\xc2\xb4m not in ground, and I\'ve been on the air for a specific time\nif (!onGround && timeSinceLastJump > cameraDelay)\n{\n //Moves the offset of the camera down to the maximum allowed y offset (In your case it would be where the lower camera is)\n if (vcam.GetCinemachineComponent<CinemachineTransposer>().m_FollowOffset.y >= maxYOffset)\n vcam.GetCinemachineComponent<CinemachineTransposer>().m_FollowOffset.y -= offsetYSensivity;\n //It also zooms out up to a specified level\n if (vcam.m_Lens.OrthographicSize < maxFOV)\n vcam.m_Lens.OrthographicSize += camSensivity;\n}\nelse\n{\n //Same but upwards\n if (vcam.GetCinemachineComponent<CinemachineTransposer>().m_FollowOffset.y <= minYOffset)\n vcam.GetCinemachineComponent<CinemachineTransposer>().m_FollowOffset.y += offsetYSensivity;\n //Same but zooming in\n if (vcam.m_Lens.OrthographicSize > minFOV)\n vcam.m_Lens.OrthographicSize -= camSensivity;\n}\nRun Code Online (Sandbox Code Playgroud)\n\n通过这种方式,您可以在特定条件下使用玩家高度,但代价是必须精心设计相机逻辑。
\n\n也许这可以在某种程度上帮助您做您想做的事。
\n