Skip to content

Instantly share code, notes, and snippets.

Last active Nov 14, 2018
What would you like to do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Jump : StateMachineBehaviour {
[SerializeField] AvatarTarget targetBodyPart = AvatarTarget.Root;
[SerializeField, Range(0, 1)] float start = 0, end = 1;
[HeaderAttribute("match target")]
public Vector3 matchPosition; // 指定パーツが到達して欲しい座標
public Quaternion matchRotation; // 到達して欲しい回転
public Vector3 positionWeight =; // matchPositionに与えるウェイト。(1,1,1)で自由、(0,0,0)で移動できない。e.g. (0,0,1)で前後のみ
public float rotationWeight = 0; // 回転に与えるウェイト。
private MatchTargetWeightMask weightMask;
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
weightMask = new MatchTargetWeightMask (positionWeight, rotationWeight);
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
animator.MatchTarget (matchPosition, matchRotation, targetBodyPart, weightMask, start, end);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment