Okay i am new to this, trying to make some boxes that works just fine with collisions and such. Thing is, i need to make the jump around a bit from clicking a button, sorta like dices.
I have started on some code, but i run into problem making them move more than just few units or jiggle.
Any help appreciated
var objDice1: GameObject;
var objDice2: GameObject;
var objDice3: GameObject;
var objDice4: GameObject;
var fFactorTorque = 1000.0;
var fReactionFactor = 1.2;
private var fAccNext = 0.0;
var fAccRate = 0.1;
function OnGUI()
{
if (GUI.Button (Rect (25, 25, 100, 30), "Roll dice"))
{
var fAcc : Vector3;
fAcc.x = 3.0;
fAcc.y = 3.0;
fAcc.z = 3.0;
objDice1.rigidbody.AddRelativeTorque(fAcc.x * fFactorTorque, fAcc.y * fFactorTorque, fAcc.z * fFactorTorque);
objDice2.rigidbody.AddRelativeTorque(fAcc.x * fFactorTorque, fAcc.y * fFactorTorque, fAcc.z * fFactorTorque);
objDice3.rigidbody.AddRelativeTorque(fAcc.x * fFactorTorque, fAcc.y * fFactorTorque, fAcc.z * fFactorTorque);
objDice4.rigidbody.AddRelativeTorque(fAcc.x * fFactorTorque, fAcc.y * fFactorTorque, fAcc.z * fFactorTorque);
}
}