WorldViz User Forum  

Go Back   WorldViz User Forum > Precision Position Tracker (PPT)

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-05-2016, 03:48 AM
rajnishv rajnishv is offline
Member
 
Join Date: Jan 2016
Location: Kalina,Sanatcruz(East),Mumbai,Maharashtra,India
Posts: 94
Smile Regarding Viconnect viewpoint

Hi Jeff,
#-----------------First Query------------------------------#

1) I want to move my viewpoint to specific point on keyboard event.
I tried using :-


"""
This is a very simple demo, but it also illustrates the use of viewpoints with
vizconnect.

Viewpoints are a method for forcing a display to be at a particular location.
The sample viewpoint in this script places the user at the top of a balcony.

You can test the effect of setting the viewpoint by adjusting the position values
for the viewpoint at the bottom of the script
"""

import viz
import vizact
import vizconnect


# start the vizconnect session stored in the given directory
vizconnect.go("vizconnect_config.py")

# oriMode sets what the viewpoint is resetting to. For example...
# vizconnect.VIEWPOINT_MATCH_DISPLAY
# matches orientation of the display to the orientation of the viewpoint
#
# vizconnect.VIEWPOINT_MATCH_FEET
# matches orientation of the feet to the orientation of the viewpoint
#
# vizconnect.VIEWPOINT_MATCH_BASE
# matches orientation of the base object (transport, avatar, tracker) to the orientation of the viewpoint
#
# Similar for posMode
oriMode = vizconnect.VIEWPOINT_MATCH_DISPLAY
posMode = vizconnect.VIEWPOINT_MATCH_FEET

# Add a viewpoint.
vp = vizconnect.addViewpoint( pos=[-13.24803, 12.28260, 8.83578],
euler=[90, 0, 0],
posMode=posMode,
oriMode=oriMode,
constant=False,
)

# Displays are added to viewpoints, the viewpoint will traverse the scenegraph to
# determine if the display is attached to an avatar, tracker, etc in order to
# perform the requested resets.
vp.add(vizconnect.getDisplay())

# Call reset viewpoints, which forces the display into the viewpoint position.
# This function can be called as often as desired, it is currently also mapped
# onto the insert button.
vizconnect.resetViewpoints()
# add a reset key so when r is pressed the user is moved back back to the viewpoint
vizact.onkeydown('r', vizconnect.resetViewpoints)


# add an environment
viz.add('piazza.osgb')

def onKeyDown(key):
global vp
print key, ' is down.'
if key == viz.KEY_TAB:
print 'you hit the tab key'
vp1 = vizconnect.addViewpoint(pos=[-16.24803, 8.28260, 8.83578],euler=[90, 0, 0],posMode=posMode,oriMode=oriMode,constant=False)

viz.callback(viz.KEYDOWN_EVENT,onKeyDown)

But the viewpoint doesn't change the position on event..for the above code.

#------------------2nd query---------------------#

Secondly i want to change and animate viewpoint(view point of vizconnect not the main view)

And i want to apply action on the viewpoint(viewpoint of vizconnect)
I dont want to apply actions on MainView..

I have tried using and will use the example of dcoumentaion


#link = viz.link(vp, viz.MainView)
#Set the animation speed and mode
SPEED = 4.5
MODE = viz.SPEED
ROTATE_MODE = viz.NO_ROTATE

def SetRotateMode(mode):
global ROTATE_MODE
ROTATE_MODE = mode

def AnimateView(pos):
action = vizact.goto(pos,SPEED,MODE,pivot=(0,1,0),rotate_mo de=ROTATE_MODE)
viz.MainView.runAction(action)(here i want vizconnect viewpoint instead of main view)

#Setup keyboard events
vizact.onkeydown('1',AnimateView,[0,10,-30])
vizact.onkeydown('2',AnimateView,[30,10,0])
vizact.onkeydown('3',AnimateView,[0,10,30])
vizact.onkeydown('4',AnimateView,[-30,20,0])


#Start off by moving to the first location
AnimateView([-16.24803, 8.28260, 8.83578])

Thank You
waiting for ur reply
Reply With Quote
  #2  
Old 05-05-2016, 05:28 AM
rajnishv rajnishv is offline
Member
 
Join Date: Jan 2016
Location: Kalina,Sanatcruz(East),Mumbai,Maharashtra,India
Posts: 94
Smile Vizconnect Viewpoint animation via transport.

Thank you Jeff, I managed it via Transport..:

The updated code to move the viewpoint...

Code:


#Set the animation speed and mode
SPEED = 12,000
MODE = viz.SPEED
ROTATE_MODE = viz.NO_ROTATE

def gotoViewPointAmeniteis(pos):
global vp
#action = vizact.goto(pos,SPEED,MODE,pivot=(0,1,0),rotate_mo de=ROTATE_MODE)
action = vizact.goto(pos,SPEED,MODE,pivot=vizconnect.getVie wpointDict(),rotate_mode=ROTATE_MODE)
vizconnect.getTransport().getNode3d().runAction(ac tion)


Cheers!!
Thank you
World Viz
Especially Jeff and Kevin
Reply With Quote
  #3  
Old 03-20-2017, 08:50 AM
arshbot arshbot is offline
Member
 
Join Date: Mar 2017
Posts: 8
Is gotoViewPointAmeniteis a callback? How is it run? Should the method be called where a trigger occurs?
Reply With Quote
  #4  
Old 03-21-2017, 12:03 AM
rajnishv rajnishv is offline
Member
 
Join Date: Jan 2016
Location: Kalina,Sanatcruz(East),Mumbai,Maharashtra,India
Posts: 94
Hi ArshBot,

I have replied to ur post,pls refer the link:
http://forum.worldviz.com/showthread.php?t=5981

OR

In the above code you have written which links the model and the transports node(containing viewpoint) that is :viz.link(transport.getNode3d(), candela).
That the reason user along with the model is moving.
Pls remove this line of code or comment it.

To understand better on using transports in vizconnect,pls refer tutorials from documentation on Inputs and Transports from Vizconnect Section.

Link:
http://docs.worldviz.com/vizard/vizc...navigators.htm
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to track the actual viewpoint Jerry Vizard 3 05-25-2016 10:44 AM
Moving main viewpoint when linked to PPT v-clizzin Precision Position Tracker (PPT) 1 04-20-2010 05:09 PM
Avatar w/ hat cannot look at viewpoint TrashcanPatrol Vizard 5 08-19-2008 09:26 AM
3d viewpoint movement spacefarer Vizard 9 07-25-2006 04:37 PM
VRML Viewpoint error bstankie Vizard 1 03-11-2003 03:10 PM


All times are GMT -7. The time now is 06:25 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC