Hi,
Thanks for replying - I’m afraid I haven’t been clear enough about the issue
The cones are rotating around the axis I expect them to be - it’s that the orientation flips when it passes the other object on the X-axis.
HPR print out:
VBase3(90, -78.6901, -1.74136e-005)
VBase3(0, -90, 0)
VBase3(-90, -78.6901, 1.74136e-005)
Initially I had a force attached to to the arrow to push the actor node along the red arrow (I’ve stripped this out of the example I’m showing).
Problem was the red arrow was flipping in the opposite direction when it passed the larger sphere on the x-axis and it started pushing the actor node back in the opposit direction…
I initially thought this was because they were on the same plane, however this doesn’t seem to be the only time this occurs…
Here is my code if it can help any… sorry it’s a messy but I’m just trying things out…
from direct.directbase.DirectStart import *
from direct.interval.IntervalGlobal import *
from pandac.PandaModules import *
from direct.showbase.DirectObject import DirectObject
from direct.task import Task
########## Setting up scene graph/geometry ###############
an = ActorNode('myActor')
anp = render.attachNewNode(an)
cs1 = CollisionSphere(0, 0, 0, 8)
cnp = anp.attachNewNode(CollisionNode('cnode')) # Build collision node parented to actor.
cnp.node().addSolid(cs1)
cnp.show() # Set collision node to show geometry.
# Gimbal attached to actor node.
arrow = loader.loadModel("cones") # Load cone.
arrow.setScale(6)
arrow.reparentTo(anp) # Parent it under actor.
pn = PandaNode("empty")
pnp = render.attachNewNode(pn)
cs2 = CollisionSphere(0, 0, 0, 15)
cnp = pnp.attachNewNode(CollisionNode('cnode'))
cnp.node().addSolid(cs2)
cnp.show() # Set collision node to show geometry.
anp.setPos(20,200,-20) # Little sphere with arrow.
pnp.setPos(5,200,0) # Big sphere.
######### setting user input ##############
class PmGameInput(DirectObject):
def __init__(s):
# Location stuff
s.accept('w-repeat', s.moveZ, [5] )
s.accept('s-repeat', s.moveZ, [-5] )
s.accept('a-repeat', s.moveX, [-5] )
s.accept('d-repeat', s.moveX, [5] )
s.accept('r-repeat', s.moveY, [5] )
s.accept('f-repeat', s.moveY, [-5] )
s.accept('w', s.moveZ, [5] )
s.accept('s', s.moveZ, [-5] )
s.accept('a', s.moveX, [-5] )
s.accept('d', s.moveX, [5] )
s.accept('r', s.moveY, [5] )
s.accept('f', s.moveY, [-5] )
s.accept('z', s.testX )
s.accept('x', s.testY )
s.accept('c', s.testZ )
def moveX(s, v):
anp.setX( anp, v )
s.onMove()
def moveY(s, v):
anp.setY( anp, v )
s.onMove()
def moveZ(s, v):
anp.setZ( anp, v )
s.onMove()
def testX(s):
anp.setPos(10, 200, 0)
def testY(s):
anp.setPos(5, 210, 0)
def testZ(s):
anp.setPos(5, 200, 5)
def onMove(s):
arrow.lookAt( pnp )
print arrow.getHpr()
input = PmGameInput()
##### run game engine's main loop ######
run()
I’ve also put the egg file on my server - but as always it’s taking time to show it on there - will post a link when it will let me download it…
Hope this makes more sence now.
Thanks so much for the help