def initTransports(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTransport = vizconnect.getRawTransportDict()

	#VC: initialize a new transport
	_name = 'main_transport'
	if vizconnect.isPendingInit('transport', _name, initFlag, initList):
		#VC: request that any dependencies be created
		if initFlag&vizconnect.INIT_INDEPENDENT:
			initTrackers(vizconnect.INIT_INDEPENDENT, ['head_tracker'])
	
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			orientationTracker = vizconnect.getTracker('head_tracker').getNode3d()
			debug = False
			acceleration = 2
			maxSpeed = 2
			rotationAcceleration = 60
			maxRotationSpeed = 65
			autoBreakingDragCoef = 0.1
			dragCoef = 0.0001
			rotationAutoBreakingDragCoef = 0.2
			rotationDragCoef = 0.0001
			usingPhysics = False
			parentedTracker = False
			transportationGroup = None
			
			#VC: create the raw object
			from transportation import wand_magic_carpet
			rawTransport[_name] = wand_magic_carpet.WandMagicCarpet(	orientationTracker=orientationTracker,
																					debug=debug,
																					acceleration=acceleration,
																					maxSpeed=maxSpeed,
																					rotationAcceleration=rotationAcceleration,
																					maxRotationSpeed=maxRotationSpeed,
																					autoBreakingDragCoef=autoBreakingDragCoef,
																					dragCoef=dragCoef,
																					rotationAutoBreakingDragCoef=rotationAutoBreakingDragCoef,
																					rotationDragCoef=rotationDragCoef,
																					usingPhysics=usingPhysics,
																					parentedTracker=parentedTracker,
																					node=transportationGroup)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTransport(rawTransport[_name], _name, make='Virtual', model='WandMagicCarpet')
	
		#VC: set the pivot of the node
		if initFlag&vizconnect.INIT_PIVOTS:
			vizconnect.getTransport(_name).setPivot(vizconnect.getAvatar('main_avatar').getAttachmentPoint('head').getNode3d())

	#VC: set the name of the default
	vizconnect.setDefault('transport', 'main_transport')

	#VC: return values can be modified here
	return None
Example #2
0
def initTransports(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTransport = vizconnect.getRawTransportDict()

	#VC: initialize a new transport
	_name = 'main_transport'
	if vizconnect.isPendingInit('transport', _name, initFlag, initList):
		#VC: request that any dependencies be created
		if initFlag&vizconnect.INIT_INDEPENDENT:
			initTrackers(vizconnect.INIT_INDEPENDENT, ['head_tracker'])
	
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			orientationTracker = vizconnect.getTracker('head_tracker').getNode3d()
			debug = False
			acceleration = 4.0
			maxSpeed = 10.44
			rotationAcceleration = 90.0
			maxRotationSpeed = 120.0
			autoBreakingDragCoef = 0.1
			dragCoef = 0.0001
			rotationAutoBreakingDragCoef = 0.2
			rotationDragCoef = 0.0001
			usingPhysics = False
			parentedTracker = False
			transportationGroup = None
			
			#VC: create the raw object
			from transportation import wand_magic_carpet
			rawTransport[_name] = wand_magic_carpet.WandMagicCarpet(	orientationTracker=orientationTracker,
																					debug=debug,
																					acceleration=acceleration,
																					maxSpeed=maxSpeed,
																					rotationAcceleration=rotationAcceleration,
																					maxRotationSpeed=maxRotationSpeed,
																					autoBreakingDragCoef=autoBreakingDragCoef,
																					dragCoef=dragCoef,
																					rotationAutoBreakingDragCoef=rotationAutoBreakingDragCoef,
																					rotationDragCoef=rotationDragCoef,
																					usingPhysics=usingPhysics,
																					parentedTracker=parentedTracker,
																					node=transportationGroup)
	
		#VC: init the mappings for the raw object
		if initFlag&vizconnect.INIT_MAPPINGS:
			#VC: per frame mappings
			if initFlag&vizconnect.INIT_MAPPINGS_PER_FRAME:
				#VC: get the raw input dict so we have access to signals
				import vizact
				rawInput = vizconnect.getConfiguration().getRawDict('input')
				#VC: set the update function which checks for input signals
				def update(transport):
					if rawInput['keyboard'].isButtonDown(17):# make=Generic, model=Keyboard, name=keyboard, signal=Key W
						transport.moveForward(mag=1)
					if rawInput['keyboard'].isButtonDown(31):# make=Generic, model=Keyboard, name=keyboard, signal=Key S
						transport.moveBackward(mag=1)
					if rawInput['keyboard'].isButtonDown(30):# make=Generic, model=Keyboard, name=keyboard, signal=Key A
						transport.moveLeft(mag=1)
					if rawInput['keyboard'].isButtonDown(32):# make=Generic, model=Keyboard, name=keyboard, signal=Key D
						transport.moveRight(mag=1)
					if rawInput['keyboard'].isButtonDown(45):# make=Generic, model=Keyboard, name=keyboard, signal=Key X
						transport.moveUp(mag=1)
					if rawInput['keyboard'].isButtonDown(44):# make=Generic, model=Keyboard, name=keyboard, signal=Key Z
						transport.moveDown(mag=1)
					if rawInput['keyboard'].isButtonDown(16):# make=Generic, model=Keyboard, name=keyboard, signal=Key Q
						transport.turnLeft(mag=1)
					if rawInput['keyboard'].isButtonDown(18):# make=Generic, model=Keyboard, name=keyboard, signal=Key E
						transport.turnRight(mag=1)
				rawTransport[_name].setUpdateFunction(update)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTransport(rawTransport[_name], _name, make='Virtual', model='WandMagicCarpet')
	
		#VC: set the pivot of the node
		if initFlag&vizconnect.INIT_PIVOTS:
			vizconnect.getTransport(_name).setPivot(vizconnect.getAvatar('main_avatar').getAttachmentPoint('head').getNode3d())

	#VC: set the name of the default
	vizconnect.setDefault('transport', 'main_transport')

	#VC: return values can be modified here
	return None
def initTransports(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
    #VC: place any general initialization code here
    rawTransport = vizconnect.getRawTransportDict()

    #VC: initialize a new transport
    _name = 'wandmagiccarpet'
    if vizconnect.isPendingInit('transport', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            orientationTracker = None
            debug = False
            acceleration = 2
            maxSpeed = 2
            rotationAcceleration = 60
            maxRotationSpeed = 65
            autoBreakingDragCoef = 0.1
            dragCoef = 0.0001
            rotationAutoBreakingDragCoef = 0.2
            rotationDragCoef = 0.0001
            usingPhysics = False
            parentedTracker = False
            transportationGroup = None

            #VC: create the raw object
            from transportation import wand_magic_carpet
            rawTransport[_name] = wand_magic_carpet.WandMagicCarpet(
                orientationTracker=orientationTracker,
                debug=debug,
                acceleration=acceleration,
                maxSpeed=maxSpeed,
                rotationAcceleration=rotationAcceleration,
                maxRotationSpeed=maxRotationSpeed,
                autoBreakingDragCoef=autoBreakingDragCoef,
                dragCoef=dragCoef,
                rotationAutoBreakingDragCoef=rotationAutoBreakingDragCoef,
                rotationDragCoef=rotationDragCoef,
                usingPhysics=usingPhysics,
                parentedTracker=parentedTracker,
                node=transportationGroup)

        #VC: init the mappings for the raw object
        if initFlag & vizconnect.INIT_MAPPINGS:
            #VC: per frame mappings
            if initFlag & vizconnect.INIT_MAPPINGS_PER_FRAME:
                #VC: get the raw input dict so we have access to signals
                import vizact
                rawInput = vizconnect.getConfiguration().getRawDict('input')

                #VC: set the update function which checks for input signals
                def update(transport):
                    if rawInput['flystick'].getJoystickPosition(
                    )[1] > 0.05:  # make=ART, model=Flystick, name=flystick, signal=Analog Down
                        transport.moveForward(mag=1.0)
                    if rawInput['keyboard'].isButtonDown(
                            17
                    ):  # make=Generic, model=Keyboard, name=keyboard, signal=Key W
                        transport.moveForward(mag=1)
                    if rawInput['flystick'].getJoystickPosition(
                    )[1] < -0.05:  # make=ART, model=Flystick, name=flystick, signal=Analog Up
                        transport.moveBackward(mag=1.0)
                    if rawInput['keyboard'].isButtonDown(
                            31
                    ):  # make=Generic, model=Keyboard, name=keyboard, signal=Key S
                        transport.moveBackward(mag=1)
                    if rawInput['keyboard'].isButtonDown(
                            30
                    ):  # make=Generic, model=Keyboard, name=keyboard, signal=Key A
                        transport.moveLeft(mag=1)
                    if rawInput['keyboard'].isButtonDown(
                            32
                    ):  # make=Generic, model=Keyboard, name=keyboard, signal=Key D
                        transport.moveRight(mag=1)
                    # if rawInput['flystick'].isButtonDown(2):# make=ART, model=Flystick, name=flystick, signal=Button 2
                    # 	transport.moveUp(mag=1.0)
                    # if rawInput['flystick'].isButtonDown(1):# make=ART, model=Flystick, name=flystick, signal=Button 1
                    # 	transport.moveDown(mag=1.0)
                    if rawInput['flystick'].getJoystickPosition(
                    )[0] < -0.05:  # make=ART, model=Flystick, name=flystick, signal=Analog Left
                        transport.turnLeft(mag=1.0)
                    if rawInput['flystick'].getJoystickPosition(
                    )[0] > 0.05:  # make=ART, model=Flystick, name=flystick, signal=Analog Right
                        transport.turnRight(mag=1.0)

                rawTransport[_name].setUpdateFunction(update)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTransport(rawTransport[_name],
                                    _name,
                                    make='Virtual',
                                    model='WandMagicCarpet')

    #VC: set the name of the default
    vizconnect.setDefault('transport', 'wandmagiccarpet')

    #VC: return values can be modified here
    return None
def initTransports(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTransport = vizconnect.getRawTransportDict()

	#VC: initialize a new transport
	_name = 'wandmagiccarpet'
	if vizconnect.isPendingInit('transport', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			orientationTracker = None
			debug = False
			acceleration = 2
			maxSpeed = 2
			rotationAcceleration = 60
			maxRotationSpeed = 65
			autoBreakingDragCoef = 0.1
			dragCoef = 0.0001
			rotationAutoBreakingDragCoef = 0.2
			rotationDragCoef = 0.0001
			usingPhysics = False
			parentedTracker = False
			transportationGroup = None
			
			#VC: create the raw object
			from transportation import wand_magic_carpet
			rawTransport[_name] = wand_magic_carpet.WandMagicCarpet(	orientationTracker=orientationTracker,
																					debug=debug,
																					acceleration=acceleration,
																					maxSpeed=maxSpeed,
																					rotationAcceleration=rotationAcceleration,
																					maxRotationSpeed=maxRotationSpeed,
																					autoBreakingDragCoef=autoBreakingDragCoef,
																					dragCoef=dragCoef,
																					rotationAutoBreakingDragCoef=rotationAutoBreakingDragCoef,
																					rotationDragCoef=rotationDragCoef,
																					usingPhysics=usingPhysics,
																					parentedTracker=parentedTracker,
																					node=transportationGroup)
	
		#VC: init the mappings for the raw object
		if initFlag&vizconnect.INIT_MAPPINGS:
			#VC: per frame mappings
			if initFlag&vizconnect.INIT_MAPPINGS_PER_FRAME:
				#VC: get the raw input dict so we have access to signals
				import vizact
				rawInput = vizconnect.getConfiguration().getRawDict('input')
				#VC: set the update function which checks for input signals
				def update(transport):
					if rawInput['flystick_analog'].getData()[1] > 0.05:# make=Generic, model=VRPN Analog, name=flystick_analog, signal=Analog 1 Positive
						transport.moveForward(mag=abs(rawInput['flystick_analog'].getData()[1]))
					if rawInput['flystick_analog'].getData()[1] < -0.05:# make=Generic, model=VRPN Analog, name=flystick_analog, signal=Analog 1 Negative
						transport.moveBackward(mag=abs(rawInput['flystick_analog'].getData()[1]))
					if rawInput['flystick_analog'].getData()[0] < -0.05:# make=Generic, model=VRPN Analog, name=flystick_analog, signal=Analog 0 Negative
						transport.moveLeft(mag=abs(rawInput['flystick_analog'].getData()[0]))
					if rawInput['flystick_analog'].getData()[0] > 0.05:# make=Generic, model=VRPN Analog, name=flystick_analog, signal=Analog 0 Positive
						transport.moveRight(mag=abs(rawInput['flystick_analog'].getData()[0]))
					if rawInput['flystick_buttons'].isButtonDown(3):# make=Generic, model=VRPN Buttons, name=flystick_buttons, signal=Button 3
						transport.moveUp(mag=1)
					if rawInput['flystick_buttons'].isButtonDown(2):# make=Generic, model=VRPN Buttons, name=flystick_buttons, signal=Button 2
						transport.moveDown(mag=1)
					if rawInput['flystick_buttons'].isButtonDown(4):# make=Generic, model=VRPN Buttons, name=flystick_buttons, signal=Button 4
						transport.turnLeft(mag=1)
					if rawInput['flystick_buttons'].isButtonDown(1):# make=Generic, model=VRPN Buttons, name=flystick_buttons, signal=Button 1
						transport.turnRight(mag=1)
				rawTransport[_name].setUpdateFunction(update)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTransport(rawTransport[_name], _name, make='Virtual', model='WandMagicCarpet')
			
		#VC: set the pivot of the node
		if initFlag&vizconnect.INIT_PIVOTS:
			vizconnect.getTransport(_name).setPivot(vizconnect.getAvatar('head_and_hand').getAttachmentPoint('head').getNode3d())

	#VC: return values can be modified here
	return None
def initTransports(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
    #VC: place any general initialization code here
    rawTransport = vizconnect.getRawTransportDict()

    #VC: initialize a new transport
    _name = 'main_transport'
    if vizconnect.isPendingInit('transport', _name, initFlag, initList):
        #VC: request that any dependencies be created
        if initFlag & vizconnect.INIT_INDEPENDENT:
            initTrackers(vizconnect.INIT_INDEPENDENT, ['head_tracker'])

        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            orientationTracker = vizconnect.getTracker(
                'head_tracker').getNode3d()
            debug = False
            acceleration = 2
            maxSpeed = 2
            rotationAcceleration = 60
            maxRotationSpeed = 65
            autoBreakingDragCoef = 0.1
            dragCoef = 0.0001
            rotationAutoBreakingDragCoef = 0.2
            rotationDragCoef = 0.0001
            usingPhysics = False
            parentedTracker = False
            transportationGroup = None

            #VC: create the raw object
            from transportation import wand_magic_carpet
            rawTransport[_name] = wand_magic_carpet.WandMagicCarpet(
                orientationTracker=orientationTracker,
                debug=debug,
                acceleration=acceleration,
                maxSpeed=maxSpeed,
                rotationAcceleration=rotationAcceleration,
                maxRotationSpeed=maxRotationSpeed,
                autoBreakingDragCoef=autoBreakingDragCoef,
                dragCoef=dragCoef,
                rotationAutoBreakingDragCoef=rotationAutoBreakingDragCoef,
                rotationDragCoef=rotationDragCoef,
                usingPhysics=usingPhysics,
                parentedTracker=parentedTracker,
                node=transportationGroup)

        #VC: init the mappings for the raw object
        if initFlag & vizconnect.INIT_MAPPINGS:
            #VC: per frame mappings
            if initFlag & vizconnect.INIT_MAPPINGS_PER_FRAME:
                #VC: get the raw input dict so we have access to signals
                import vizact
                rawInput = vizconnect.getConfiguration().getRawDict('input')

                #VC: set the update function which checks for input signals
                def update(transport):
                    if rawInput['r_hand_input'].getTrackpad(
                    )[1] > 0.01:  # make=HTC, model=Vive Controller, name=r_hand_input, signal=Trackpad Top
                        transport.moveForward(
                            mag=abs(rawInput['r_hand_input'].getTrackpad()[1]))
                    if rawInput['r_hand_input'].getTrackpad(
                    )[1] < -0.01:  # make=HTC, model=Vive Controller, name=r_hand_input, signal=Trackpad Bottom
                        transport.moveBackward(
                            mag=abs(rawInput['r_hand_input'].getTrackpad()[1]))
                    if rawInput['r_hand_input'].getTrackpad(
                    )[0] < -0.01:  # make=HTC, model=Vive Controller, name=r_hand_input, signal=Trackpad Left
                        transport.moveLeft(
                            mag=abs(rawInput['r_hand_input'].getTrackpad()[0]))
                    if rawInput['r_hand_input'].getTrackpad(
                    )[0] > 0.01:  # make=HTC, model=Vive Controller, name=r_hand_input, signal=Trackpad Right
                        transport.moveRight(
                            mag=abs(rawInput['r_hand_input'].getTrackpad()[0]))

                rawTransport[_name].setUpdateFunction(update)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTransport(rawTransport[_name],
                                    _name,
                                    make='Virtual',
                                    model='WandMagicCarpet')

        #VC: set the pivot of the node
        if initFlag & vizconnect.INIT_PIVOTS:
            vizconnect.getTransport(_name).setPivot(
                vizconnect.getAvatar('main_avatar').getAttachmentPoint(
                    'head').getNode3d())

    #VC: set the name of the default
    vizconnect.setDefault('transport', 'main_transport')

    #VC: return values can be modified here
    return None
def initTransports(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
    #VC: place any general initialization code here
    rawTransport = vizconnect.getRawTransportDict()

    #VC: initialize a new transport
    _name = 'wandmagiccarpet'
    if vizconnect.isPendingInit('transport', _name, initFlag, initList):
        #VC: request that any dependencies be created
        if initFlag & vizconnect.INIT_INDEPENDENT:
            initTrackers(vizconnect.INIT_INDEPENDENT, ['head_tracker'])

        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            orientationTracker = vizconnect.getTracker(
                'head_tracker').getNode3d()
            debug = False
            acceleration = 2
            maxSpeed = 2
            rotationAcceleration = 60
            maxRotationSpeed = 65
            autoBreakingDragCoef = 0.1
            dragCoef = 0.0001
            rotationAutoBreakingDragCoef = 0.2
            rotationDragCoef = 0.0001
            usingPhysics = False
            parentedTracker = False
            transportationGroup = None

            #VC: create the raw object
            from transportation import wand_magic_carpet
            rawTransport[_name] = wand_magic_carpet.WandMagicCarpet(
                orientationTracker=orientationTracker,
                debug=debug,
                acceleration=acceleration,
                maxSpeed=maxSpeed,
                rotationAcceleration=rotationAcceleration,
                maxRotationSpeed=maxRotationSpeed,
                autoBreakingDragCoef=autoBreakingDragCoef,
                dragCoef=dragCoef,
                rotationAutoBreakingDragCoef=rotationAutoBreakingDragCoef,
                rotationDragCoef=rotationDragCoef,
                usingPhysics=usingPhysics,
                parentedTracker=parentedTracker,
                node=transportationGroup)

        #VC: init the mappings for the raw object
        if initFlag & vizconnect.INIT_MAPPINGS:
            #VC: per frame mappings
            if initFlag & vizconnect.INIT_MAPPINGS_PER_FRAME:
                #VC: get the raw input dict so we have access to signals
                import vizact
                rawInput = vizconnect.getConfiguration().getRawDict('input')

                #VC: set the update function which checks for input signals
                def update(transport):
                    if rawInput['ppt_wand'].getJoystickPosition(
                    )[1] < -0.05:  # make=WorldViz, model=PPT Wand, name=ppt_wand, signal=Analog Up
                        transport.moveForward(mag=abs(
                            rawInput['ppt_wand'].getJoystickPosition()[1]))
                    if rawInput['ppt_wand'].getJoystickPosition(
                    )[1] > 0.05:  # make=WorldViz, model=PPT Wand, name=ppt_wand, signal=Analog Down
                        transport.moveBackward(mag=abs(
                            rawInput['ppt_wand'].getJoystickPosition()[1]))
                    if rawInput['ppt_wand'].isButtonDown(
                            1
                    ):  # make=WorldViz, model=PPT Wand, name=ppt_wand, signal=Top Left Button
                        transport.moveLeft(mag=1)
                    if rawInput['ppt_wand'].isButtonDown(
                            2
                    ):  # make=WorldViz, model=PPT Wand, name=ppt_wand, signal=Top Right Button
                        transport.moveRight(mag=1)
                    if rawInput['ppt_wand'].isButtonDown(
                            0
                    ):  # make=WorldViz, model=PPT Wand, name=ppt_wand, signal=Bottom Left Button
                        transport.moveUp(mag=1)
                    if rawInput['ppt_wand'].isButtonDown(
                            3
                    ):  # make=WorldViz, model=PPT Wand, name=ppt_wand, signal=Bottom Right Button
                        transport.moveDown(mag=1)
                    if rawInput['ppt_wand'].getJoystickPosition(
                    )[0] < -0.05:  # make=WorldViz, model=PPT Wand, name=ppt_wand, signal=Analog Left
                        transport.turnLeft(mag=abs(
                            rawInput['ppt_wand'].getJoystickPosition()[0]))
                    if rawInput['ppt_wand'].getJoystickPosition(
                    )[0] > 0.05:  # make=WorldViz, model=PPT Wand, name=ppt_wand, signal=Analog Right
                        transport.turnRight(mag=abs(
                            rawInput['ppt_wand'].getJoystickPosition()[0]))

                rawTransport[_name].setUpdateFunction(update)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTransport(rawTransport[_name],
                                    _name,
                                    make='Virtual',
                                    model='WandMagicCarpet')

        #VC: set the parent of the node
        if initFlag & vizconnect.INIT_PARENTS:
            vizconnect.getTransport(_name).setParent(vizconnect.getRoot())

    #VC: return values can be modified here
    return None