GeRayCollider work only in Perspective view?



  • On 08/05/2014 at 10:19, xxxxxxxx wrote:

    Hi! 
    As title... 
    for views Top...

    cam_pos = bd.GetSceneCamera(doc).GetAbsPos()

    is not recognized....

    cursorpos = bd.SW(c4d.Vector(mx,my,500))

    collider = c4d.utils.GeRayCollider()
    collider.Init(mypoly)
    length = 500000
    direction = -(cam_pos - cursorpos).GetNormalized()
    did_intersect = collider.Intersect(cam_pos, direction, length)

    if did_intersect:
    position = collider.GetNearestIntersection()["hitpos"]

    else:
    position = cursorpos

    doc.AddUndo(c4d.UNDOTYPE_CHANGE, myobject)
    myobject.SetAbsPos(position)

    where I am wrong?



  • On 08/05/2014 at 12:19, xxxxxxxx wrote:

    Hi,

    It works...
    But be aware if you change to e.g. Top view, your

    cam_pos = bd.GetSceneCamera(doc).GetAbsPos()

    is c4d.Vector(0,0,0)

    Martin


Log in to reply