- Home /
Confusing Error
I am working on this game, and I keep getting this error, and the "coins" are not deleting themselvs like they should after I get the error. Thanks!
The Error Reads: Actor::updateMassFromShapes: Compute mesh inertia tensor failed for one of the actor's mesh shapes! Please change mesh geometry or supply a tensor manually! UnityEngine.Object:Instantiate(Object, Vector3, Quaternion) CoinCreater:CreateCoin() (at Assets/Resources/Scripts/CoinCreater.js:29)
Ignore the Commented parts on my script, they are for later.
#pragma strict
var xpos : float;
var spawnpoint : Vector3;
var coin : GameObject;
var rotation : Quaternion;
rotation.eulerAngles = new Vector3(0, 0, 0);
var newCoin :Object;
function Start () {
InvokeRepeating("CreateCoin", 1, 1);
}
function Update () {
Destroy(GameObject.FindWithTag("Coin"),10);
}
function CreateCoin(){
xpos = Random.Range(-50.0,50.0);
spawnpoint = new Vector3(xpos, 80, 0);
var myColor : Color; // This is just working for another part of my script, Please Ignore.
var mode : boolean = Random.value > 0.5f;
var rand : float = Random.value;
var index : int = Random.Range( 0, 3 );
myColor[index] = rand;
myColor[( index + ( mode ? 1 : 2 ) ) % 3] = 1;
myColor[( index + ( mode ? 2 : 1 ) ) % 3] = 0;
newCoin = Instantiate(coin, spawnpoint, rotation);
//newCoin = newCoin as GameObject;
}
Answer by RyanZimmerman87 · Feb 06, 2014 at 04:40 AM
Well you could try to replace:
newCoin = Instantiate(coin, spawnpoint, rotation);
with:
newCoin = Instantiate(coin, spawnpoint, Quaternion.identity);
That's a pretty strange error you're getting so I would try that first.
Also this logic looks a little strange to me. You are checking to destroy the coins every Update() but with a 10 second delay? Yet you are only creating coins every second?
I guess I don't really understand what you are trying to accomplish here on first glance.
I'm not 100% sure but you might be selecting the same coin every time and resetting the destroy time to 10 seconds so it never gets destroyed? Perhaps Destroy() assigns a unique property to that specific gameObject and the newest property overwrites the old one. Never really thought about this before or tried to test how it works but maybe you are just constantly telling it to destroy in 10 seconds so it never gets there?
That's a lot of guessing but I hope that I somehow help.
Edit: found some info on that error:
http://answers.unity3d.com/questions/14497/actorupdatemassfromshape-error.html
Sounds like you should try to use a box collider instead of plane collider or maybe remove a rigid body. You can check it out I just skimmed through it.
Hey, for some reason I cannot comment.... So this is a comment. Ill try to look up how to fix it but it just keeps saying 10 Characters needed even though I type >10.
But you're right! I changed the mesh and collider to a cube with a width of 0.1 and it doesnt give me that error any more! Thanks!
Your answer
![](https://koobas.hobune.stream/wayback/20220613132652im_/https://answers.unity.com/themes/thub/images/avi.jpg)