Hi guys, I’ve started Unity few days ago, and am curious about several things.
- Is there any way to scale things not by abstractic numbers but numbers with objective values.
1-2. if I can how would I do those?
-
How does script works without crashing even though I am using two scripts with same named function “Update” in one object? would it crash in some point? or is it totally ok to use few scripts in one object with Update functions in each script?
-
Can i get properties from rigidbody? f.e collision, velocity, and so on.
- The scale can be whatever you want it to be. Since most physics formulas are based on the metric system, I think that’s what most people use. 1 unit = 1 meter, this makes sense to me as well since gravity is already by default set to -9.8 in the Editor.
1-2.1) Scripts contain classes, which in themselves contain functions. Two classes that use the same function name is fine, because it will know the difference between ClassA.Update and ClassB.Update. You cannot however, have two Updates in the same class/script.
-
Most properties are public, which means you can access them. Scripting API - RigidBody
public Rigidbody rb;
void Start()
{
rb.velocity = new Vector3(2f, 0f, 0f);
}
Collisions are a little bit different, you don’t access them from the RigidBody as a property. Unity Manual - Colliders