Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Razer Hydra Dll Bind Player Input and Player Controller. Ready to go.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    #16

    Comment


      #17
      @skwisdemon666

      I downloaded your code and was trying to add Dakor's 1:1 rotation. Yea it's definitely missing the oldRightHandRotation variable, did you just change the name or are you using a different set of variables to work out rotation?

      The duelwield crosshairs look real good, how do you think they'd work in first person?

      Comment


        #18

        http://www.mediafire.com/?lz51focstkgw56g
        This folder contains code and content used in the video. Code is free for all, assets are for non-commercial use. I didn't bother deleting non-hydra things out of the code because I didn't want to accidentally erase something that was needed. So I will leave it up to you what to keep and what to throw away. As always, I love to receive comments and suggestions.
        As an added note, I suggest changing the near clip plane in your config files to something around 3.
        I'm still having trouble with xbox controllers, it say xbox controller found in the startup logs but I can't get any input from it or make it rumble...
        I'm thinking about saving up for a Oculus Rift and integrating that into the project. When watching some developer conferences, people seem to be having trouble getting a HUD to work well with it. I've been working on some math that I think could make everything line up right if a scaleform HUD was mapped to a dome shape.

        Comment


          #19
          I Have made a big update to improve stability of gesture recognition. It will be in the next download I post. It uses an array to keep track of the last twenty gestures and pick the most occurring value in the array as the current gesture.

          Comment


            #20
            Ok, here is a mini-update. Download that last link I put up then open up the RazerHydraPlayerController.
            ADD
            Code:
            var array<int> RightGestures;
            var array<int> RightGestureCounts;
            var array<int> LeftGestures;
            var array<int> LeftGestureCounts;
            then replace the LeftMotionGesture and RightMotionGesture functions with

            Code:
            function LeftMotionGesture(int VelocityGesture, int AccelerationGesture, int RotVelocityGesture, int RotAccelerationGesture)
            {
            	local int CurrentGesture, ArrayItem, ItemIndex, ItemNumber;
            	
            	if(VelocityGesture==5 && AccelerationGesture==5)
            	{
            		CurrentGesture=5;
            	}
            	if(VelocityGesture==-5 && AccelerationGesture==-5)
            	{
            		CurrentGesture=10;
            	}
            	else if(VelocityGesture!=0 && RotVelocityGesture!=0)
            	{
            		if(VelocityGesture==5 || VelocityGesture==RotVelocityGesture)
            		{
            			CurrentGesture=RotVelocityGesture+10;
            		}
            	}
            	else if(VelocityGesture==0 && RotVelocityGesture!=0)
            	{
            		if(RotVelocityGesture==RotAccelerationGesture)
            		{
            			CurrentGesture=RotVelocityGesture+20;
            		}
            	}
            	else if(VelocityGesture==0 && RotVelocityGesture==0)
            	{
            		CurrentGesture=0;
            	}
            	
            	if(LeftGestures.Length>20)
            	{
            		LeftGestures.Remove( 0, 1);
            	}
            	
            	LeftGestures.AddItem(CurrentGesture);
            	ItemNumber=0;
            	LeftGestureCounts.Remove(0, LeftGestureCounts.Length);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	LeftGestureCounts.AddItem(0);
            	
            	
            	foreach LeftGestures(ArrayItem, ItemIndex)
            	{
            		LeftGestureCounts[ArrayItem]+=1;
            	}
            	
            	foreach LeftGestureCounts(ArrayItem, ItemIndex)
            	{
            		if(ArrayItem>ItemNumber)
            		CurrentGesture=ItemIndex;
            		ItemNumber=ArrayItem;
            	}
            	
            	If(CurrentGesture!=OldLeftGesture)
            	{
            		if(CurrentGesture==0)
            		{
            			LeftStop();
            		}
            		else if(CurrentGesture==5)
            		{
            			LeftSwingUR();
            		}
            		else if(CurrentGesture==10)
            		{
            			LeftSwingUC();
            		}
            		else if(CurrentGesture==19)
            		{
            			LeftSwingUR();
            		}
            		else if(CurrentGesture==18)
            		{
            			LeftSwingUC();
            		}
            		else if(CurrentGesture==17)
            		{
            			LeftSwingUL();
            		}
            		else if(CurrentGesture==16)
            		{
            			LeftSwingCR();
            		}
            		else if(CurrentGesture==14)
            		{
            			LeftSwingCL();
            		}
            		else if(CurrentGesture==13)
            		{
            			LeftSwingDR();
            		}
            		else if(CurrentGesture==12)
            		{
            			LeftSwingDC();
            		}
            		else if(CurrentGesture==11)
            		{
            			LeftSwingDL();
            		}
            		else if(CurrentGesture==29)
            		{
            			LeftFlickUR();
            		}
            		else if(CurrentGesture==28)
            		{
            			LeftFlickUC();
            		}
            		else if(CurrentGesture==27)
            		{
            			LeftFlickUL();
            		}
            		else if(CurrentGesture==26)
            		{
            			LeftFlickCR();
            		}
            		else if(CurrentGesture==24)
            		{
            			LeftFlickCL();
            		}
            		else if(CurrentGesture==23)
            		{
            			LeftFlickDR();
            		}
            		else if(CurrentGesture==22)
            		{
            			LeftFlickDC();
            		}
            		else if(CurrentGesture==21)
            		{
            			LeftFlickDL();
            		}
            		
            		OldLeftGesture=CurrentGesture;
            		`log("LeftGesture="$CurrentGesture);
            	}
            }
            
            function RightMotionGesture(int VelocityGesture, int AccelerationGesture, int RotVelocityGesture, int RotAccelerationGesture)
            {
            	local int CurrentGesture, ArrayItem, ItemIndex, ItemNumber;
            	
            	if(VelocityGesture==5 && AccelerationGesture==5)
            	{
            		CurrentGesture=5;
            	}
            	if(VelocityGesture==-5 && AccelerationGesture==-5)
            	{
            		CurrentGesture=10;
            	}
            	else if(VelocityGesture!=0 && RotVelocityGesture!=0)
            	{
            		if(VelocityGesture==5 || VelocityGesture==RotVelocityGesture)
            		{
            			CurrentGesture=RotVelocityGesture+10;
            		}
            	}
            	else if(VelocityGesture==0 && RotVelocityGesture!=0)
            	{
            		if(RotVelocityGesture==RotAccelerationGesture)
            		{
            			CurrentGesture=RotVelocityGesture+20;
            		}
            	}
            	else if(VelocityGesture==0 && RotVelocityGesture==0)
            	{
            		CurrentGesture=0;
            	}
            	
            	if(RightGestures.Length>20)
            	{
            		RightGestures.Remove( 0, 1);
            	}
            	RightGestures.AddItem(CurrentGesture);
            	ItemNumber=0;
            	RightGestureCounts.Remove(0, RightGestureCounts.Length);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	RightGestureCounts.AddItem(0);
            	
            	
            	foreach RightGestures(ArrayItem, ItemIndex)
            	{
            		RightGestureCounts[ArrayItem]+=1;
            	}
            	
            	foreach RightGestureCounts(ArrayItem, ItemIndex)
            	{
            		if(ArrayItem>ItemNumber)
            		CurrentGesture=ItemIndex;
            		ItemNumber=ArrayItem;
            	}
            	
            	If(CurrentGesture!=OldRightGesture)
            	{
            		if(CurrentGesture==0)
            		{
            			RightStop();
            		}
            		else if(CurrentGesture==5)
            		{
            			RightSwingUR();
            		}
            		else if(CurrentGesture==10)
            		{
            			RightSwingUC();
            		}
            		else if(CurrentGesture==19)
            		{
            			RightSwingUR();
            		}
            		else if(CurrentGesture==18)
            		{
            			RightSwingUC();
            		}
            		else if(CurrentGesture==17)
            		{
            			RightSwingUL();
            		}
            		else if(CurrentGesture==16)
            		{
            			RightSwingCR();
            		}
            		else if(CurrentGesture==14)
            		{
            			RightSwingCL();
            		}
            		else if(CurrentGesture==13)
            		{
            			RightSwingDR();
            		}
            		else if(CurrentGesture==12)
            		{
            			RightSwingDC();
            		}
            		else if(CurrentGesture==11)
            		{
            			RightSwingDL();
            		}
            		else if(CurrentGesture==29)
            		{
            			RightFlickUR();
            		}
            		else if(CurrentGesture==28)
            		{
            			RightFlickUC();
            		}
            		else if(CurrentGesture==27)
            		{
            			RightFlickUL();
            		}
            		else if(CurrentGesture==26)
            		{
            			RightFlickCR();
            		}
            		else if(CurrentGesture==24)
            		{
            			RightFlickCL();
            		}
            		else if(CurrentGesture==23)
            		{
            			RightFlickDR();
            		}
            		else if(CurrentGesture==22)
            		{
            			RightFlickDC();
            		}
            		else if(CurrentGesture==21)
            		{
            			RightFlickDL();
            		}
            		
            		OldRightGesture=CurrentGesture;
            		
            		`log("RightGesture="$CurrentGesture);
            		//`log("RightGesture="$CurrentGesture);
            	}
            }
            This adds what I call "uber-redundancy" to the motion gesuture recognition that makes it very accurate and stable. If you run udk with the log window up you can move the controller around and see for yourself. (It just prints out the number, so use your numpad to decode :P)

            Also, in the RazerHydraInput
            change DistanceScale=0.f to DistanceScale=14.0f to avoid needing to calibrate (this value should work for most adults, to correctly calibrate sit arms length away from base station holding hydras to chest when you call the calibrate function)

            Comment


              #21
              Hey, thanks for sharing this

              Really useful to have working reference code! I created a short video to show the samples you provided (for my blog, but others may find it useful)

              Comment


                #22
                That video is cool. I think I heard somewhere that 64-bit dll support was added, so if this is true i'm going to see if I can get a 64-bit version of the sixense dll...

                Comment


                  #23
                  Great work skwisdemon666 and also thanks for sharing all of your work with everyone!! What great support from the community!

                  Sixense has since released official scripts to integerate the Hydra into UDK. You can find the latest here: http://sixense.com/forum/vbulletin/s...se-UDK-Support .



                  We include a simple example as well:

                  Comment


                    #24
                    Great. I can't wait to dive in and see how this works. It is probably much more optimized than my code lol. Will this also support STEM when they ship? (Eagerly awaiting mine)

                    Comment

                    Working...
                    X