Search Unity

Adding Colliders to each VectorLine Point3 Value

Discussion in 'Scripting' started by hotshotiguana, Sep 4, 2012.

  1. hotshotiguana

    hotshotiguana

    Joined:
    Aug 1, 2012
    Posts:
    34
    I have created a few different VectorLines using Vectrosity and I am trying to figure out the best/most efficient way to hover over a point3 on the line and have a pop-up show up.

    I was able to display a pop-up when hovering over the VectorLine using the below code, but the BoxCollider appears to cover too much space (see included image):

    Code (csharp):
    1.  
    2. lines[0].vectorObject.AddComponent("BoxCollider");
    3. lines[0].vectorObject.AddComponent("LineHoverOver"); // where LineHoverOver is a script that produces a pop-up box on hovering
    4. lines[0].vectorObject.collider.isTrigger = true;
    5.  
    Is it optimal to create a new GameObject at every linePoint (the line points I am using are in world space and not attached to a transform) and then assign a collider to that game object? If so, what scale should I make the gameObject if I use a line width of 2 in Vectrosity, so it only covers the exact point and maybe a 10% radius around the point?

    Or has anyone run across a better solution?

    $Screen shot 2012-09-04 at 3.45.48 PM.png