-
Notifications
You must be signed in to change notification settings - Fork 20
/
ContactInfo.cs
59 lines (51 loc) · 1.3 KB
/
ContactInfo.cs
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
58
59
using UnityEngine;
using System.Collections.Generic;
namespace Sample07
{
/// 碰撞点信息
public class ContactInfo
{
/// 碰撞点
public Vector2 point;
/// 穿透方向
public Vector2 normal;
/// 穿透深度
public float penetration;
/// 碰撞点的hash值,用来累加碰撞结果
public int hash;
/// 法线方向的分离力
public float forceNormal;
/// 切线方向的分离力
public float forceTangent;
public float bias;
/// 法线方向质量系数
public float massNormal;
/// 切线方向的质量系数
public float massTangent;
}
public enum CollisionStage
{
None,
Enter,
Stay,
Exit,
}
public class CollisionPair
{
public int updateIndex;
public Rigidbody rigidbodyA;
public Rigidbody rigidbodyB;
public bool isTrigger;
public CollisionStage stage;
public List<ContactInfo> contacts = new List<ContactInfo>();
public GJK gjk;
}
public class CollisionInfo
{
public Rigidbody rigidbody;
public Entity entity;
public Vector2 point;
public Vector2 normal;
public float penetration;
}
}