blob: 431b65929c21b6b86c45395c01fa008dc2bb9deb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
using Rigging.BodyPart;
using Rigging.Debugging;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Rigging.Data
{
public class MovementDataHandler : RiggingDataBase
{
[HideInInspector, NonSerialized]
public Vector3 groundedForward;
[HideInInspector, NonSerialized]
public Vector3 right;
[HideInInspector, NonSerialized]
public Vector3 left;
[HideInInspector, NonSerialized]
public Vector3 groundedBack;
[HideInInspector, NonSerialized]
public float sinceJump = 1f;
[HideInInspector, NonSerialized]
public float slopeStrenght;
public Transform rotationTarget;
private Rigging.BodyPart.Hip hip;
protected override void OnStart()
{
base.OnStart();
hip = player.body.hip;
}
private void Update()
{
sinceJump += Time.deltaTime;
groundedForward = rotationTarget.forward;
groundedForward.y = slopeStrenght * 1f;
groundedForward = groundedForward.normalized;
groundedBack = -groundedForward;
right = rotationTarget.right;
left = -rotationTarget.right;
slopeStrenght = Mathf.Lerp(slopeStrenght, 0f, Time.deltaTime * 1f);
//GLHandle.DrawLine(hip.transform.position, hip.transform.position + groundedForward * 10f);
}
}
}
|