#1
|
|||
|
|||
mainview
I am trying to make the mainview to keep its moving with the avatar’s moving and speeds as well, I tried with the following simple code.
Code:
import viz viz.go() # add room room = viz.add('court.ive') # add subject female= viz.add('vcc_female.cfg') female.setPosition([0,0,0]) female.state(2) walk=vizact.move(0,0,5,5) female.addAction(walk) viz.MainView.getPosition(female.getPosition()) print female.getPosition But does not working |
#2
|
|||
|
|||
Code:
viz.MainView.getPosition(female.getPosition()) This will only occur once though, you'll need a timer callback function to constantly acquire the position of the avatar and assign it to the main view position. Something like: Code:
def myTimer(num): newPosition = female.getPosition() offset = [0,0,5] # Maybe add an offset so the camera isn't directly ontop of the avatar to keep it in view? viz.MainView.setPosition(newPosition+offset) viz.callback(viz.TIMER_EVENT,myTimer) # Pass callback viz.starttimer(0,0.5,viz.FOREVER) # Start the timer |
#3
|
|||
|
|||
Sorry, that above callback won't work right...try this:
Code:
def myTimer(num): newPosition = female.getPosition() newPosition[2] = newPosition[2]-2 # Move back in Z a bit newPosition[1] = newPosition[1]+1.5 # Move up in Y a bit viz.MainView.setPosition(newPosition) print female.getPosition() Last edited by DrunkenBrit; 02-18-2009 at 02:38 AM. |
#4
|
|||
|
|||
you can also try linking the viewpoint to the avatar. This following lines create a link and then creates an offset so the view is behind the avatar
Code:
view = viz.MainView link = viz.link(female, view) link.preTrans([0,0,-1]) |
#5
|
|||
|
|||
Thanks for the info.
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Linking problems with Live Character | Frank Verberne | Vizard | 5 | 06-04-2008 11:42 AM |
Looking through the eyes of an avatar | Frank Verberne | Vizard | 2 | 04-01-2008 05:52 AM |