All I wanted to do was move the centre of mass of a rigid body, but it wouldn’t work unless I put it in an update, like this.
using System.Collections;
public class CoM : MonoBehaviour {
void Update() {
rigidbody.centerOfMass = new Vector3(0, 0, -2);
}
}
I just don’t see why you can’t put it in a custom method like “void MoveCenter()”.
Btw I’m learning Unity3d and C# at the same time.
Ah. Thanks. I guess the Unity Engine doesn't call custom methods. That's why we have start?
– Jason210If you want custom methods to be called, you call them yourself from Start(),Awake(),Update().. depends on what behaviour you want. If I helped you out, please click the check-mark on the left of my answer. :)
– UnitraxxYes thanks. I understand how this works now.
– Jason210Unity does not directly call custom methods, because it doesn't even know they exist! You have to call them yourself.
– syclamothSyclamoth - Yes I get it now, finally! It makes sense. I didn't before - I was just doing things parrot fashion, but now things are starting to fall into place.
– Jason210