Object constructor
Object({})
Implementation
Object({
List<Mesh>? mesh,
Vector3? position,
Vector3? rotation,
Vector3? scale,
Size? size,
this.name = 'Object',
this.visible = true,
this.imageLocation = 0,
this.type = SelectedType.image,
this.color = Colors.red,
this.layer = 1,
this.scaleAllowed = true,
}){
if (position != null) position.copyInto(this.position);
if (rotation != null) rotation.copyInto(this.rotation);
if (scale != null) scale.copyInto(this.scale);
updateTransform();
this.size = size ?? const Size(50,50);
if(type == SelectedType.collision){layer = 4;}
else if(type == SelectedType.rect){layer = 2;}
this.mesh = mesh??[Mesh(
vertices: [
Vector3(0,0,0),
Vector3(this.size.width,0,0),
Vector3(this.size.width,this.size.height,0),
Vector3(0,this.size.height,0)
],
indices: [Triangle([0,1,2], null, null),Triangle([2,3,0], null, null)],
colors: [color,color]
)];
}