DrawLine

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/11/2010 at 18:03, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   12 
Platform:   Windows  ;   
Language(s) :     C++  ;

---------
I am trying to draw a line in 3D space,   however with the following code:

  
  BaseObject *op = doc->GetActiveObject();  
  if (!op) return TOOLDRAW_0;  
  
  bd->SetMatrix_Matrix(NULL, Matrix());  
  
  bd->SetPen(Vector(1,0,1));  
    
  Vector position = op->GetRelPos();  
  
  bd->DrawLine2D(position, position + (0,   0,   600));  
  bd->DrawLine2D(position, position + (0,   600, 0));  
  bd->DrawLine2D(position, position + (600, 0,   0));  
  
    
  return TOOLDRAW_HANDLES;  

I get a line being drawn across the view port instead of in 3d space.   I thought that DrawLine() replaced Line3D()?   Am I doing something wrong?

~Shawn

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/11/2010 at 20:40, xxxxxxxx wrote:

You are showing DrawLine2D() instead of DrawLine() in your code.  DrawLine2D() only draws in Screen space (2D).

Remember that the DrawLine() coordinates must be in World space (not local - which is what GetRelPos() retrieves!).  You would be better served using:

Vector position = op->GetMg().off;