[CLOSED] DzVec3.dot return allways a positif number which is wrong

darkdesiredarkdesire Posts: 21

Hello, i need to know if 2 vectors are in the same direction. So i use the dot method from DzVec3 and it returns allways a positif number even if the two directions are opposite.

example:

DzVec3(38.1018,13.0803,-117.265).dot(DzVec3(0,106.945,0.342321) )

return: 1358.727294921875

it must return -1358.72

thank

Post edited by darkdesire on

Comments

  • Richard HaseltineRichard Haseltine Posts: 101,482

    Are you sure? I get the same as script calculating long-hand.

  • Richard HaseltineRichard Haseltine Posts: 101,482

    Using your vector and antiparallel vectors of my own gives the expected result in scripting:

    print ( DzVec3(38.1018,13.0803,-117.265).dot(DzVec3(0,106.945,0.342321) ) );
    print ( DzVec3(1,1,1).dot(DzVec3(-1,-1,-1) ) );

    gives

    1358.73046875
    -3

  • oups,

    made a big mistake. It works, didn't verify the vector orientation in my test. sorry all is good

Sign In or Register to comment.