WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-14-2018, 06:54 AM
zmm zmm is offline
Member
 
Join Date: Feb 2018
Posts: 2
Problems with Multi User

I am following the Multi User environment example to create a scene with a server and two clients, I am having two issues:

1. Shared environment: I want the users to inhabit the same environment so that if events happen in one all will see it. At the moment all users can see each others movements but if I want have something happen, such as a ball appearing, it only appears in the triggered frame, be that the server or client 1 or client 2, not all three. Is there a way to have both users see the same environment without having to program each object movement separately (there will be more than 20).

2. View point: I have my users inhabit either the male or female avatar however the view point is centered at the feet, which means when I set the mainview to what should be eye level the avatar is floating and when I set it to zero the view point is on the ground, how can I adjust this? (later I will connect the avatar to head trackers but at the moment I want it to work on two computers)

Thank you in advance for any help!
Reply With Quote
  #2  
Old 02-14-2018, 09:02 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
1. It's necessary to program the scene changes for each user when using Vizard's networking library. If you have multiple Vizard 5 Enterprise licenses and only one user will be manipulating the environment (e.g. grabbing objects, triggering events) using clustering and the co-presence feature maybe an option for you.

2. How are you setting this up, is there a link between the viewpoint and avatar?

Also, take a look at our Vizible software, which is designed for VR collaboration between two users.
Reply With Quote
  #3  
Old 02-16-2018, 09:45 AM
zmm zmm is offline
Member
 
Join Date: Feb 2018
Posts: 2
Thank you for your reply. I will try out what you suggest for the first point.

For the second point: In my code (see below for the core code), there is not a link to the avatar but selected from the object list, how do I link it to the head if I don't have the tracker?

Code:
###server###
import viz
import viznet
import steve
import random

viz.go()
viz.clearcolor(.2,.2,.4)

viz.MainWindow.fov(60)

viz.MainView.setPosition([0,1.5,-6])
viz.MainView.setEuler([0,0,0])

objectList = ['vcc_male.cfg','vcc_female.cfg'] 
maze = viz.add('piazza.osgb') 

objects = {} 

UPDATE = viznet.id('update') 
CLIENT_DISCONNECTED = viznet.id('client_disconnected') 
CHAT = viznet.id('chat') 


viznet.server.start(port_in=14950,port_out=14951) 

def onStartClient(e): 
    print '** Client joined with username:',e.username 
viz.callback(viznet.CLIENT_CONNECT_EVENT,onStartClient) 

def onStopClient(e): 
    print '** Client left with username:',e.username 
    viznet.server.send(CLIENT_DISCONNECTED,client=e.sender,username=e.username) 
    objects[e.username].remove() 
    del objects[e.username]
viz.callback(viznet.CLIENT_DISCONNECT_EVENT,onStopClient) 

def update(e): 
    try: 
        objects[e.username].setPosition(e.pos) 
        objects[e.username].setEuler(e.ori)  
        objects[e.username].state(e.state)
    except KeyError:
        objects[e.username] = viz.add(objectList[e.object],scale=[1,1,1],pos=e.pos,euler=e.ori) 
        objects[e.username].tooltip = e.username
        objects[e.username].state(e.state)
viz.callback(UPDATE,update)
Code:
###client###
import viz
import viznet
import vizinfo
import vizinput

viz.go()
viz.clearcolor(.2,.2,.4)
maze = viz.add('piazza.osgb')
objects = {}

UPDATE = viznet.id('update') 
CLIENT_DISCONNECTED = viznet.id('client_disconnected') 
CHAT = viznet.id('chat') 

SERVER_NAME='PC04720'

USER_NAME='client1'

while not viznet.client.connect(SERVER_NAME,port_in=14951,port_out=14950,username=USER_NAME): 
    if vizinput.ask('Could not connect to ' + SERVER_NAME + ' would you like to try another?'): 
        SERVER_NAME=vizinput.input('Enter Server Name') 
    else: 
        viz.quit() 
        break 
objectList = ['vcc_male.cfg','vcc_female.cfg'] 
obj_choice=vizinput.choose('Connected. Select your character',objectList)

#set initial position
viz.MainView.setPosition([2, 0 ,0])
viz.MainView.setEuler([270,0,0])
currentState = 1

def sendUpdate():
    ori= viz.MainView.getEuler()
    pos = viz.MainView.getPosition()
    viznet.client.sendAll(UPDATE,client=viz.getComputerName(),object=obj_choice,pos=pos,ori=ori, state=currentState, username=USER_NAME)
vizact.ontimer(.05,sendUpdate)

def update(e): 
    if e.username != USER_NAME: 
        try: 
            objects[e.username].setPosition(e.pos) 
            objects[e.username].setEuler(e.ori) 
        except KeyError: 
            objects[e.username] = viz.add(objectList[e.object],scale=[1,1,1],pos=e.pos,euler=e.ori) 
            objects[e.username].tooltip = e.client 
viz.callback(UPDATE,update) 

def client_disconnected(e): 
    objects[e.username].remove() 
    del objects[e.username] 
viz.callback(CLIENT_DISCONNECTED,client_disconnected) 

def onExit():
    viznet.client.disconnect(username=USER_NAME)
viz.callback(viz.EXIT_EVENT,onExit)

def onStopServer(e): 
    print 'Disconnected from server' 
    viz.quit() 
viz.callback(viznet.SERVER_DISCONNECT_EVENT,onStopServer)
Reply With Quote
  #4  
Old 02-19-2018, 09:15 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Here's example code of linking both the avatar and view to a virtual tracker. The link operators can be adjusted to change where the viewpoint is in relation to the avatar:

Code:
"""
forward='w',backward='s',left='a',right='d'
"""

import viz
import vizcam
import vizinfo

viz.go()
vizinfo.InfoPanel()

dojo = viz.addChild('dojo.osgb')
avatar = viz.addAvatar('vcc_male2.cfg')
avatar.state(2)

tracker = vizcam.addKeyboard6DOF(forward='w',backward='s',left=None,right=None,up=None,down=None,turnRight='d',turnLeft='a',pitchDown=None,pitchUp=None,rollRight=None,rollLeft=None)
avatarLink = viz.link(tracker,avatar)
viewLink = viz.link(tracker,viz.MainView)
viewLink.preTrans([0,2,-2])
viewLink.preEuler([0,10,0])
Reply With Quote
Reply

Tags
multi user

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
multi user environment tutorial maya Vizard 0 11-23-2013 09:35 AM
multi user maya Vizard 1 11-18-2013 10:31 AM
Problems Ending Animation atalantis Vizard 2 03-01-2013 12:49 PM
Problems using viznet.client.connect fordprefect Vizard 2 10-18-2012 03:34 PM
Multi User Environment moneim230 Vizard 5 05-17-2011 06:56 PM


All times are GMT -7. The time now is 10:10 PM.


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