Quaternions problem ( + Bullet)

I’m not used to use quaternions, it is the first time I’m working with them. Since there aren’t examples about using them I’ve hit a brick wall.

I’m trying to shoot a ball in the mouse direction. If the mouse is closer to the player the shot will have height, if the mouse is further away the shot is low.

Right now I have this:

I’ve no idea how I can pass a “Z angle” to my quaternion in such way that the shot will be high instead of low. Any ideas how I can achieve this behavior?


Any way to achieve something like this in Panda?

I’ve tried some stuff but there aren’t many examples with quaternions out there.

Q1 = my_trans.get_quat()
Q5 = Quat(Q1[0],Q1[1],Q1[2],Q1[3])
force = Q5.setFromAxisAngle(-45.0, Q5.getRight()) * Q5.getForward()

It doesn’t work