WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 10-20-2016, 05:55 AM
Patrick Patrick is offline
Member
 
Join Date: Oct 2016
Posts: 13
Use Controller as Grabing tool

Hello,
im trying to use the controller as a tracker.
the basic idea is i want to move the right/left arm with a controller to grab things and replace them in my 3d world.
My program currently runs via a oculus rift dk2 display and has the dk2 tracker to move around in the world.
What i am basicly aiming for is to add an avatar whos arm i can move with the controller. But all i found was just the input which reacts to my controller orders but i cant connect to for example the left arm of my "head and arms" avatar cause you can only connect trackers to body parts of avatars, as it seems.
I dont want to create a transport in via i want to controll a body part of my avatar to prevent confusions.
So i assume i have to create a new tracker right? do i have to use an merged tracker and give him the Xbox settings? if thats the case how do i setup that merge tracker? or am i completely wrong and i have to do sth completely different?

Thanks in advance
Patrick
Reply With Quote
  #2  
Old 10-20-2016, 04:44 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,448
One way to do this is create a group tracker for each hand in the trackers tab. Then apply the group tracker to the avatar hand in the animator section of the avatar. In the events tab create events for moving the hand in different directions and map the events to controller signals. Then in either the postInit function of the vizconnect file or in the calling script, handle the events and update the group tracker position. I've attached an example that moves the hand with keypresses instead of Xbox controller signals. The code to update the group hand tracker is in the postInit function. Press 1 and 2 to move the hand in and out.
Attached Files
File Type: zip vizconnect_config_hand_example.zip (2.7 KB, 272 views)
Reply With Quote
  #3  
Old 10-21-2016, 06:34 AM
Patrick Patrick is offline
Member
 
Join Date: Oct 2016
Posts: 13
Ok i now understand how you can assign the keys to the tracker via the input but i am missing the code for that

def update(event):
if rawInput['keyboard'].isButtonDown(3):
event.sendEvent(e=viz.Event(mag=1))
rawEvent[_name].setUpdateFunction(update)

basicly here i realise that .isButtonDown(3): is the command for the 2 key on the keyboard
but how do i for example trigger the B button on my xbox controller? i just dont seem to find the documentation for that.
All i found was the joystick basics: http://docs.worldviz.com/vizard/Vizjoy_basics.htm

I added the joystick as input to your example and tried to setup the event code afterwards but i cant really complete these lines

def update (event):
if raw_input['joystick'] <-i guess here is sth missing
event.sendEvent(e=viz.Event(mag=1))
rawEvent[_name].setUpdateFunction(update)

Sorry for bothering with that cause it feels like that must be one of the simpliest things but i just dont know how to go on
really appreciate your help

Last edited by Patrick; 10-21-2016 at 06:36 AM. Reason: missspelling
Reply With Quote
  #4  
Old 10-31-2016, 02:52 AM
Patrick Patrick is offline
Member
 
Join Date: Oct 2016
Posts: 13
After a bit more trying i get the following Error:
TypeError: 'function' object has no attribute '__getitem__' in my move_hand_out Event Code
I just added the .XBOX_BUTTON_DPAD_UP line in
I attached my Input code and the event code maybe you could help me there
Click image for larger version

Name:	Event_move_hand_out.PNG
Views:	291
Size:	23.5 KB
ID:	846
Click image for larger version

Name:	Input_joystick.PNG
Views:	314
Size:	26.7 KB
ID:	847
Reply With Quote
  #5  
Old 10-31-2016, 04:19 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,448
The vizconnect configuration file I attached before can be modified to move the hand in/out using the Xbox controller without manually changing the code. Run the config and go to the advanced menu. In the Inputs tab add the Xbox controller. In the Events tab, press the mapping button for each of the events. Then change the input from keyboard to xbox controller and assign the button that will trigger the event.
Attached Thumbnails
Click image for larger version

Name:	xbox_event_mapping.png
Views:	258
Size:	53.7 KB
ID:	848  
Reply With Quote
  #6  
Old 11-01-2016, 02:25 AM
Patrick Patrick is offline
Member
 
Join Date: Oct 2016
Posts: 13
Worked perfectly fine - thank you very much
Reply With Quote
Reply

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
Regarding Vizard+LeapMotion Hardware Controller Integration rajnishv Vizard 7 11-23-2016 09:11 AM
Using highlighter tool with wand Samuli Vizard 2 09-24-2015 12:50 PM
PS3 controller Darkmax Plug-in development 2 02-26-2010 11:57 AM


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


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