Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    DrawLine

    Scheduled Pinned Locked Moved SDK Help
    2 Posts 0 Posters 229 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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;

        1 Reply Last reply Reply Quote 0
        • First post
          Last post