| 1234567891011121314151617181920212223242526272829303132333435363738 |
- using TMPro;
- using UnityEngine;
- using UnityEngine.UI;
- public class DebugController : MonoBehaviour
- {
- public TextMeshProUGUI debugText;
- public TextMeshProUGUI statusText;
- public GameObject player;
- public Terrain terrain;
- public RocketDataScript rocketData;
- // Start is called once before the first execution of Update after the MonoBehaviour is created
- void Start()
- {
-
- }
- // Update is called once per frame
- void Update()
- {
- var center = terrain.terrainData.heightmapResolution / 2;
- var height = terrain.terrainData.GetHeight(center, center); // * terrain.terrainData.size.y
- var rb = player.GetComponent<Rigidbody>();
- var collider = player.GetComponent<Collider>();
- debugText.text = $"center: {collider.bounds.center}\n" +
- $"extents: {collider.bounds.extents}\n" +
- $"min: {collider.bounds.min}\n" +
- $"terrain height: {height}\n" +
- $"player.y: {player.transform.position.y}";
- statusText.text = $"fuel: {rocketData.Fuel}\n" +
- $"thrustLever: {rocketData.ThrustLever}\n" +
- $"velocity: {rb.linearVelocity.y}\n" +
- $"mass: {rocketData.Mass}";
- }
- }
|