AimSwing (AimIK)

本文介绍如何通过调整AimIK的Axis属性,实现武器挥砍动画的重定向,以适应不同场景需求。通过修改动画中武器挥砍方向的矢量值,可以精确控制动画的指向,达到更佳的视觉效果。

了解如何动态调整AimIK的“Axis”,以实现武器挥砍动画的重定向。
在这里插入图片描述

using UnityEngine;
using System.Collections;
using RootMotion.FinalIK;

namespace RootMotion.Demos {

	public class AimSwing : MonoBehaviour {

		public AimIK ik;
		[Tooltip("The direction of the animated weapon swing in character space. Tweak this value to adjust the aiming.")]
        //动画角色在角色空间中摆动的方向。调整这个值来调整瞄准。
        public Vector3 animatedSwingDirection = Vector3.forward;

		void LateUpdate () {
			ik.solver.axis = ik.solver.transform.InverseTransformVector(ik.transform.rotation * animatedSwingDirection);
		}
	}
}

效果:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值