View Single Post
  #4  
Old 08-15-2008, 08:43 AM
TrashcanPatrol TrashcanPatrol is offline
Member
 
Join Date: Aug 2008
Posts: 43
I've found out that there's another code conflicting with the avatar's looking patterns for some reason... It's the callback for when I put the arrow following the player's movement in the Bird's Eye view.
Note: The map I'm using for this thing is room.wrl, so the Bird's Eye is tweaked so that it is specifically for that level.

Code:
# Create a new window in the upper right corner
UpperRightWindow = viz.add(viz.WINDOW)
UpperRightWindow.position(0.75, 1.0)
UpperRightWindow.size(0.3, 0.3)
UpperRightWindow.visible(0,viz.SCREEN)

# Create a new viewpoint
BirdView = viz.add(viz.VIEWPOINT)

#Attach the bird's eye view to the upper right window
UpperRightWindow.viewpoint(BirdView)

#Move the view above the center of the room
BirdView.translate(-1,20,2)

#Rotate the view so that it looks down
BirdView.rotate(1,0,0,90)

arrow = viz.add('arrow.wrl')
arrow.scale(0.5,0.5,0.5)

def mytimer(num):
    #Get the current head orientation and position
    ori = viz.get(viz.VIEW_YAW)
    pos = viz.get(viz.HEAD_POS)
   
#    #Move the rear view to the current position
#    RearView.translate(pos)
#   
#    #Rotate the rear view so that it faces behind us
#    RearView.rotate(0,1,0,ori+180)
#   
    #Move the arrow to our current location
    arrow.translate(pos[0],3.3,pos[2])
    arrow.rotate(ori,-90,0)

# Disable collisions with the arrow
arrow.disable(viz.COLLISION)   

# Create callback to a timer and start it
viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(0,0.001,-1)
Is there any way you guys would recommend that would allow for me to have both the Bird's Eye view at the topright with the arrow pointing to the player's position, as well as have the avatar looking towards the player?
Reply With Quote