Hi, i have a code to calculate the distance from one object to another, but not sure if this is in meters or what, how can i make this in meters to get an accurate calculation with all my objects?
Thanks!
…this is the code:
var other : Transform;
if (other) {
var dist = Vector3.Distance(other.position, transform.position);
print ("Distance to other: " + dist);
}
…and if the distance its messured from the origin of the object to the origin of the other object, how about to calculate from the collide side to the collide side of the other object for example?, just guessing…perhaps the better way its using raycast?..
Great, thanks, so for games with a human scale its good to make this meter to meter calculation (makeing a model in meters to use it in Unity), and use meters as Unity units, and the distance showed by the code will be meters then.
– EdyvargasYou can use a 1 foot equals 1 game unit system if you prefer. Meters is pretty standard for the industry, but as long as you kept everything consistent, you can definitely use a 1 Ft: 1 GU setup. If you were building a city game you might use 1 mile : 1 game unit, etc. If you were building a game featuring insects, it may be more sensible to use a 1 inch : 1 GU setup.
– eatsleepindieKeep in mind that the Physics in Unity assumes 1 unit = 1 meter.
– GameVortex@eatsleepindie - I'd disagree that metres is a standard for the industry. Max defaults to inches and Maya uses centimetres, for example (http://blogs.unity3d.com/2011/09/02/art-assets-best-practice-guide/). The most important thing is consistency, not just within the scale of your models, but in any physics calculations etc.
– tanoshimi