I get this error message:
I want to create a diamond from a GameObject’s position, and make it spin.
var nextCreateTime = 0;
var Diamond : Transform;
function Update () {
if(Time.time > nextCreateTime)
{
var newdiamond : Transform;
newdiamond = Instantiate(Diamond,transform.position+(Random.insideUnitSphere/10),Random.rotation / 300);
newdiamond.rigidbody.AddTorque(Random.rotation);
nextCreateTime = Time.time + 10;
}
}
How do I acccess the new instance’s rigidbody so I can give it some torque?
random.rotation returns a quaternion and you want a vector3 for addTorque
Great!! I never seen something work so gracefully!
I would have never figure that out on my own, I need to learn what a quaternion is, I thought rotation should have been defined by a Vector3, weird huh
quaternions are a way to deal with 3d rotations using imaginary numbers - i dont attempt to understand them but you can read the wiki if you want
In mathematics, the quaternion number system extends the complex numbers. Quaternions were first described by the Irish mathematician William Rowan Hamilton in 1843 and applied to mechanics in three-dimensional space. The algebra of quaternions is often denoted by H (for Hamilton), or in blackboard bold by
H
.
{\displaystyle \mathbb {H} .}
Quaternions are not a field, because multiplication of quaternions is not, in gen
...