Vec3 question

I would like to know what the “cross” function of a Vec3 does, as it doesn’t entirely make sense.

And, also, if it’s not much trouble, I would like to know what the “dot” function does, too.

Thank you in advance,

I dont have alot of time, so heres a website for ya :slight_smile: … plication/

Hmm… Is there a function to get the H, P, and R of a Vec3?

Use the square-bracket operators, e.g. h = v[0], p = v[1], r = v[2].


No, here’s what I mean:

def lookAtHpr(VecToMeasure):
firstMeasurer = render.attachNewNode(‘firstMeasurer’)
secondMeasurer = render.attachNewNode(‘secondMeasurer’)
return secondMeasurer.getHpr()

And then you do:
v = Vec3(1,0,0)
a = lookAtHpr(v)
a is then Point3(90,0,0)

However, I want to replace the line a = lookAtHpr(v) with something like:
a = v.***()

There is a global function called lookAt() which performs this calculation, but it performs it on a matrix or quaternion. Then you can extract the hpr from the matrix or quaternion. It’s a little bit simpler than the NodePath-based calculation. Of course, it is a complicated calculation.

q = Quat()
lookAt(q, v)
a = q.getHpr()