Okay, so i have a panda inside a ball. (bullet sphere). I have code where i can apply torque, but, i have a camera gimbal set up around it where id like to apply the torque the direction the camera is facing. (Think like Marble Blast Ultra).
I think I need the getRelativeVector() function, but im def not using it right. HELP =b
The gimbal set up is 2 nodes, one x (only changes heading), one y (only changes pitch), camera parented to y, y parented to x and x parented to render. (at the moment, id like it to be parented to ball but then it rotates. )
They are on gimbals to avoid loss of degree of freedom.
def processInput(self, dt):
torque = Vec3(0, 0, 0)
# you need ot set force and torque in relation to the camera x y plane
#torque_direction =
#la = self.lookAt(self.sphereNP)
#orient = self.gimbal_x.getRelativeVector(self.boxNP, Vec3(0,1,0))
#orient = Vec3(self.gimbal_x.getHpr(self.boxNP)).forward()
#print(orient)
if inputState.isSet('forward'): torque.setY(1.0)
if inputState.isSet('reverse'): torque.setY(-1.0)
if inputState.isSet('left'): torque.setX(-1.0)
if inputState.isSet('right'): torque.setX(1.0)
torque *= 10.0
torque = render.getRelativeVector(self.gimbal_x, torque)
print(torque)
self.sphereNP.node().setActive(True)
self.sphereNP.node().applyTorque(torque)