using SHADE; using System; public class PhysicsTest : Script { [SerializeField] [Tooltip("Force to apply when pressing Space.")] private Vector3 Force = new Vector3(0.0f, 200.0f, 0.0f); private Transform Transform; private RigidBody RigidBody; private Collider Collider; public PhysicsTest(GameObject gameObj) : base(gameObj) { } protected override void awake() { Transform = GetComponent(); if (Transform == null) { Debug.LogError("Transform is NULL!"); } RigidBody = GetComponent(); if (RigidBody == null) { Debug.LogError("RigidBody is NULL!"); } Collider = GetComponent(); if (Collider == null) { Debug.LogError("Collider is NULL!"); } var subColider = Collider.CollisionShapeCount; Debug.Log($"There are {subColider} colliders."); } protected override void update() { if (Input.GetKeyUp(Input.KeyCode.Space)) { RigidBody.AddForce(Force); Debug.Log($"Jump!"); } Debug.Log($"{Transform.LocalPosition.y}"); } protected override void onCollisionEnter(CollisionInfo info) { Debug.Log($"Collision Enter: {info.GameObject.Name}"); } protected override void onCollisionStay(CollisionInfo info) { Debug.Log($"Collision Stay: {info.GameObject.Name}"); } protected override void onCollisionExit(CollisionInfo info) { Debug.Log($"Collision Exit: {info.GameObject.Name}"); } protected override void onTriggerEnter(CollisionInfo info) { Debug.Log($"Trigger Enter: {info.GameObject.Name}"); } protected override void onTriggerStay(CollisionInfo info) { Debug.Log($"Trigger Stay: {info.GameObject.Name}"); } protected override void onTriggerExit(CollisionInfo info) { Debug.Log($"Trigger Exit: {info.GameObject.Name}"); } }