Add Shield(新增盾牌)

在手腕或者手肘下面新增空对象(weaponhandle)下面新建一个cube盾牌,再调的时候注意穿模问题;
当你的盾牌加上去之后,会出现问题:当你在待机状态的时候盾牌是在防御状态的,这时候就需要让美术师调整模型,或者里用程式码微调模型;
利用程式码调整动画:IK Pass(当你上勾的时候引擎才会帮你调用OnAnimatorIK() )在Base Layer上将IK Pass勾选 增加LeftArmAnimFix脚本,再此脚本中调用OnAnimatorIK() 在这个函数中找到小臂这跟骨头,并将它给一个角度让产生一个角度

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LeftArmAnimFix : MonoBehaviour {
    private Animator anim;
    public Vector3 a;

    private void Awake()
    {
        anim = GetComponent<Animator>();
    }
    private void OnAnimatorIK()
    {
        Transform leftLowerArm = anim.GetBoneTransform(HumanBodyBones.LeftLowerArm);//找到哪个骨头
        leftLowerArm.localEulerAngles +=0.75f* a;//加角度
        anim.SetBoneLocalRotation(HumanBodyBones.LeftLowerArm,Quaternion.Euler(leftLowerArm.localEulerAngles));//将旋转量写回去
    }

}

这时候会产生一个问题:当盾牌和地面碰撞的时候会以为盾牌的碰撞框和地面发生物理碰撞,摄影机会疯狂抖动。解决这个问题:新增一个Layer(weapon)将weapon层和ground层不进行物理运算(Edit>>project settings>>physics)将里面weapon的碰撞只保留weapon和weapon的碰撞。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值