gpt4 book ai didi

unity3d - 动态控制 Unity Cinemachine vCams Blends : HOW?

转载 作者:行者123 更新时间:2023-12-04 21:02:31 25 4
gpt4 key购买 nike

我找不到如何根据英雄的速度和高度不断地在 3 个摄像机(我称它们为中、上和下)之间动态混合。

跟随英雄时,中间的 vCam 是主要/基础的,我想根据英雄的高度按比例混合上下 vCam。

玩家/英雄可以在高度之间快速移动,因此应该轻松地对混合进行加权。这是 Cinemachine 混合的自然组成部分。和作品。但对我来说,就我目前对 Cinemachine 混合的理解而言,这就像一个开关,而不是基于高度的恒定动态混合。

最佳答案

您可以考虑移除上下摄像头,并仅使用中间摄像头进行自己的“手动混合”。最近我一直在使用 Cinemachine,我做了一些类似于你想要的结果的事情。

由于我不完全知道您希望您的相机如何工作,我向您展示了我所做的一些手动混合,解释说:

//Camera Direction
//If I´m not in ground, and I've been on the air for a specific time
if (!onGround && timeSinceLastJump > cameraDelay)
{
//Moves the offset of the camera down to the maximum allowed y offset (In your case it would be where the lower camera is)
if (vcam.GetCinemachineComponent<CinemachineTransposer>().m_FollowOffset.y >= maxYOffset)
vcam.GetCinemachineComponent<CinemachineTransposer>().m_FollowOffset.y -= offsetYSensivity;
//It also zooms out up to a specified level
if (vcam.m_Lens.OrthographicSize < maxFOV)
vcam.m_Lens.OrthographicSize += camSensivity;
}
else
{
//Same but upwards
if (vcam.GetCinemachineComponent<CinemachineTransposer>().m_FollowOffset.y <= minYOffset)
vcam.GetCinemachineComponent<CinemachineTransposer>().m_FollowOffset.y += offsetYSensivity;
//Same but zooming in
if (vcam.m_Lens.OrthographicSize > minFOV)
vcam.m_Lens.OrthographicSize -= camSensivity;
}

通过这种方式,您可以在条件中使用您的玩家高度,但代价是必须设计好相机逻辑。

也许这会以某种方式帮助您做您想做的事。

关于unity3d - 动态控制 Unity Cinemachine vCams Blends : HOW?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56113196/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com