Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.Playables;
- public class PositionPlayableBehaviour : PlayableBehaviour
- {
- public GameObject targetObject;
- public Vector3 startPosition;
- public Vector3 endPosition;
- public override void ProcessFrame(Playable playable, FrameData info, object playerData)
- {
- if (targetObject == null)
- {
- return;
- }
- var t = (float)playable.GetTime() / (float)playable.GetDuration();
- float leapt = (t * t) * (3f - (2f * t));
- targetObject.transform.localPosition = Vector3.Lerp(startPosition, endPosition, Mathf.Clamp01(leapt));
- }
- }
Add Comment
Please, Sign In to add comment