:idea:
we are know well that Vector3 Struct has its own ‘Class Variables’ like ‘zero,one,forward,up.right’ and we can use it like that ’ vector3.forward, Vector3.up …etc’ how can i make my custom class variable for example called ‘p1’ and use it as ’ Vector3.p1 ’ I tried but I doubt that there is a wrong syntax, here is my skeleton code:
var p1 : Transform;
function Vector3.p1(x,y,z) {
x=p1.position.x;
y=p1.position.y;
z=0;
}
function FixedUpdate() {
rigidbody.AddForce(Vector3.p1);
}
Thanks for posting twice …
The code nearest what I’m thinking in, but the first object don’t go exact to second object position, the right event is object1 define object2 position then go to it.
I reach the same result with this simple code:
var p1 : GameObject;
var p1p : Vector3;
function FixedUpdate() {
p1p=p1.transform.position;
rigidbody.AddForce(p1p);
}
Unless you’re using a language like Python then you can’t augment the existing class externally. Instead what you can do is make a derived class and add your new functions to that.