Anyone have a basic script outline of a temperature meter (a GUI starting with 98 degrees and steadily decreasing or increasing), and can change temperature when in range of a specific object (i.e: a campfire for warmth)?
If someone could outline a script that starts me off, that’d be absolutely great. Thanks!
Temperature will move closer to the surrounding temperature over time. For a rather crude approximation I would do the following.
Create a script that records the temperature of each GameObject
Use a sphere cast at some defined frequency, or use OnTriggerStay, to get the temperature of all nearby GameObjects
Adjust the temperature closer to the average of all the temperatures of nearby objects
You could also define an ambient temperature to use if no GameObjects are close
For an accurate approximation grab a university level physics or engineering textbook, and look up the chapter on thermodynamics and heat transfer. This is not a light topic, I’d suggest running with an approximation rather then trying to create accurate temperature physics.