[Example] Some kind of arrow
Draws a box from one vector to another.
To be used as some kind of arrow.
Need feedback if its a better way to do this, but so far seem to be ok for my purposes.
Example usage:
ArrowUi *t = new ArrowUi(Vec3(0.0, 0.0, 0.0), testshadow->GetModel()->GetPosition());
class ArrowUi {
   private:
    Model *model;
    Entity *pivot;
    Vec3 from;
    Vec3 to;
    float distance;
   public:
    ArrowUi();
    ArrowUi(Vec3 from, Vec3 to);
    void From(Vec3 from);
    void To(Vec3 to);
    void Draw();
};
ArrowUi::ArrowUi() {
   model = NULL;
   surface = NULL;
   pivot = NULL;
   from = NULL;
   to = NULL;
}
ArrowUi::ArrowUi(Vec3 from, Vec3 to) {
   this->from = from;
   this->to = to;
   Draw();
}
void ArrowUi::From(Vec3 from) {
   this->from = from;
}
void ArrowUi::To(Vec3 to) {
   this->to = to;
}
void ArrowUi::Draw() {
   pivot = Pivot::Create();
   pivot->SetPosition(from, true);
   distance = from.DistanceToPoint(to);
   model = Model::Box(0.05, 0.05, distance, pivot);
   model->Move(0, 0, distance/2);
   pivot->AlignToVector(to - from, 0);
   pivot->AlignToVector(to - from, 1);
   pivot->AlignToVector(to - from, 2);
}
- 
					
						
					
							
								
							
							
								1
							
					
						
					
				 
		
							
0 Comments
Recommended Comments
There are no comments to display.