c# - unity 自行车踏板同步动画脚本
问题描述
我正在尝试在 Unity 中为我的自行车模型制作动画,因为我将动画装备与骑自行车的模型一起使用,并且我能够使用以下代码对其进行动画处理。
private void RotateRightFoot(
float in_deltatime
)
{
Vector3 targetPos =
_rightPositions[_rightIndex].localPosition;
Vector3 curPos =
_RightFootTarget.transform.localPosition;
targetPos.z =
curPos.z;
float step =
_speed * in_deltatime;
Vector3 newRot =
Vector3.MoveTowards(curPos,targetPos,step);
_RightFootTarget.localPosition =
newRot;
if( curPos == targetPos )
{
_rightIndex++;
if( _rightIndex >= _positions.Length )
{
_rightIndex = 0;
}
_startRightPos =
targetPos;
}
}
使用上面的代码,我在自行车踏板上移动右脚,但现在我想将踏板与骑自行车的人的脚部运动同步,因为我不擅长数学,所以我不知道如何完成它。
我在踏板上有一个 pvot,所以我要做的就是旋转它,但我不知道要旋转多少..
解决方案
推荐阅读
- r - 如何根据不同的分组在 R 中制作和组织均值和 sds 表
- javascript - 延迟更新计算值,直到设置了某些所需状态
- html - 带有弹性框的 HTML 模板
- python - 将其从 DataFram 转换为 List 后 Col 丢失
- azure-functions - 解决方案中的多个 Azure 功能项目
- excel - 将 excel 工作表转换为 .txt,在 Excel VBA 中复制的数字应不带引号“”
- javascript - nodemon 应用程序崩溃 - 在从服务器获得响应后开始错误之前等待文件更改
- javascript - 使用 html 服务器运行 Node.js 应用程序
- r - 在 Shiny 的隐藏部分取消暂停元素
- java - 检查 LocalTime 是否在 Java 范围内?