Dart Documentationsystem_transformTransform

Transform class

class Transform extends ComponentPoolable {
 static final CT = ComponentTypeManager.getTypeFor(Transform);

 Vector3 position3d;
 Vector3 rotation3d;
 Vector3 scale3d;

 // 2d view
 Vector2 _position2d = new Vector2.zero();
 double get angle => rotation3d.z;
 set angle(double v) => rotation3d.z = v;
 Vector2 get position {
   _position2d.x = position3d.x;
   _position2d.y = position3d.y;
   return _position2d;
 }
 set position(Vector2 v) {
   position3d.x = v.x;
   position3d.y = v.y;
 }

 Transform._();
 static _ctor() => new Transform._();
 factory Transform.w2d(double x, double y, double a) {
   return new Transform.w3d(new Vector3(x, y, 0.0), new Vector3(0.0, 0.0, a));
 }
 factory Transform.w3d(Vector3 position, [Vector3 rotation, Vector3 scale]) {
   var c = new Poolable.of(Transform, _ctor) as Transform;
   c.position3d = position;
   c.rotation3d = (rotation == null) ? new Vector3(0.0, 0.0, 0.0) : rotation;
   c.scale3d = (scale == null) ? new Vector3(1.0, 1.0, 1.0) : scale;
   return c;
 }
 /// this method mofidy the Transform (usefull for creation)
 /// return this
 Transform lookAt(Vector3 target, [Vector3 up]) {
   math2.lookAt(target, position3d, rotation3d, up);
   return this;
 }
}

Extends

Component > Component_Poolable > ComponentPoolable > Transform

Static Properties

final CT #

static final CT = ComponentTypeManager.getTypeFor(Transform)

Constructors

factory Transform.w2d(double x, double y, double a) #

factory Transform.w2d(double x, double y, double a) {
 return new Transform.w3d(new Vector3(x, y, 0.0), new Vector3(0.0, 0.0, a));
}

factory Transform.w3d(Vector3 position, [Vector3 rotation, Vector3 scale]) #

factory Transform.w3d(Vector3 position, [Vector3 rotation, Vector3 scale]) {
 var c = new Poolable.of(Transform, _ctor) as Transform;
 c.position3d = position;
 c.rotation3d = (rotation == null) ? new Vector3(0.0, 0.0, 0.0) : rotation;
 c.scale3d = (scale == null) ? new Vector3(1.0, 1.0, 1.0) : scale;
 return c;
}

Properties

double angle #

double get angle => rotation3d.z;
set angle(double v) => rotation3d.z = v;

Vector2 position #

Vector2 get position {
 _position2d.x = position3d.x;
 _position2d.y = position3d.y;
 return _position2d;
}
set position(Vector2 v) {
 position3d.x = v.x;
 position3d.y = v.y;
}

Vector3 position3d #

Vector3 position3d

Vector3 rotation3d #

Vector3 rotation3d

Vector3 scale3d #

Vector3 scale3d

Methods

void cleanUp() #

inherited from ComponentPoolable

If you need to do some cleanup when removing this component override this method.

void cleanUp() {}

Transform lookAt(Vector3 target, [Vector3 up]) #

this method mofidy the Transform (usefull for creation) return this

Transform lookAt(Vector3 target, [Vector3 up]) {
 math2.lookAt(target, position3d, rotation3d, up);
 return this;
}

void moveToPool() #

inherited from Component_Poolable

Calls the cleanup function and moves this object to the ObjectPool.

void moveToPool() {
 cleanUp();
 ObjectPool.add(this);
}