View Single Post
  #7  
Old 01-11-2016, 08:15 AM
Seadna Seadna is offline
Member
 
Join Date: Nov 2015
Posts: 40
Question

OK I'm struggling with getting this into my code:

Code:
# Setup arrow key navigation
MOVE_SPEED = 2.0
def UpdateView():
                yaw,pitch,roll = viewLink.getEuler()
                m = viz.Matrix.euler(yaw,0,0)
                dm = viz.getFrameElapsed() * MOVE_SPEED
                if viz.key.isDown(KEYS['forward']):
                                m.preTrans([0,0,dm])
                if viz.key.isDown(KEYS['back']):
                                m.preTrans([0,0,-dm])
                if viz.key.isDown(KEYS['left']):
                                m.preTrans([-dm,0,0])
                if viz.key.isDown(KEYS['right']):
                                m.preTrans([dm,0,0])
                if viz.key.isDown(KEYS['up']):
                                m.preTrans([0,dm,0])
                if viz.key.isDown(KEYS['down']):
                                m.preTrans([0,-dm,0])
                if viz.key.isDown(KEYS['lt']):
                                m.turnLeft                           
                if viz.key.isDown(KEYS['rt']):
                                m.turnRight                            
                navigationNode.setPosition(m.getPosition(), viz.REL_PARENT)

vizact.ontimer(0,UpdateView)
You can see the lines I have put in with m.turnLeft and m.turnRight. These do not work like in the vizconnect example. I'm sure i need to add much more code or replace what I have here but there is so much in there that i dont know what to do with it.

I tried putting in m.preEuler(0,dm,0) and adding navigationMode.setEuler(m.getEuler(), viz.REL_PARENT) but that causes the view to rapidly spin constantly.
Reply With Quote