Results 1 to 2 of 2
  1. #1

    value error:math domain error

    greetz members

    the code below works fine in runtime but return a "value error:math domain error " on line13 in console. not really
    good in python so cant figured out where to fix .... pls help?
    from math import degrees,acos
    cont = GameLogic.getCurrentController()
    own = cont.getOwner()
    scn = GameLogic.getCurrentScene()
    obj = scn.getObjectList()
    sp = obj['OBSphere']
    act = cont.actuators["act"]     
    vect = own.getVectTo(sp)
    b = degrees(acos(vect[2][1]))      this is line 13
    if b < 30 :
     act.object = sp

  2. #2
    Member VegetableJuiceF's Avatar
    Join Date
    Aug 2012
    Basic math fun time,
    what is the domain of the arc cosine function?
    What is the domain of vector components? Probably [-inf,inf]
    Your vector is not of unit length.

    Not really a python question, but you can use unitVect = vect.normalized().

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts