UE3 - UDK Sixense/Razer Hydra dual-wielding: I can change arm location. How about gun direction

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Nathaniel3W

Member
Nov 11, 2012
48
0
6
I'm getting close. Soon I'll upload videos of what all of you have been helping me with.

I'm using two SkelControl_CCID_IK's attached to b_RightHand and b_LeftHand to change my pawn's arm positioning. That's working more or less OK. (Actually, the pawn's hands are always the same distance from the torso regardless of how far away I'm holding the controllers. I'd prefer for the elbows to bend depending on how far away the controllers are, but I can save that for another day.)

I'm trying to use two UDKSkelControl_LockRotation's attached to b_RightWeapon and b_LeftWeapon now in an attempt to control the guns' directions.

The thing I'm having trouble with right now is pointing the guns independently of where I'm holding the controllers. The Sixense can detect the controllers' location and rotation. I have the Sixense's location set as a vector, and the rotation set as a quaternion, and the gun points along the location vector regardless of which way I'm pointing the controller.

In my PlayerController class I have this:
Code:
	RightArmLocation = RightArmLocation >> ViewRotation;
	LeftArmLocation = LeftArmLocation >> ViewRotation;
	
	Utp = MyUnrealGamePawn(Pawn);
	
	Utp.RightArmIK.EffectorLocation = Utp.Location + RightArmLocation; 
	Utp.LeftArmIK.EffectorLocation = Utp.Location + LeftArmLocation;
	Utp.RightWeaponRot.LockRotation = QuattoRotator(RightWeaponQuat);
	Utp.LeftWeaponRot.LockRotation = QuattoRotator(LeftWeaponQuat);

That all comes after loading the appropriate data into the ArmLocation vectors and weapon quaternions. Pay no mind to the Utp reference. There's no UT stuff in here (well, except for the meshes and skins). I just never changed that from a tutorial I was reading.

Like I said, the arm location is working right, but the gun direction doesn't seem to be doing anything at all.

Just in case it's relevant, this is in my Pawn class:
Code:
simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
{
	super.PostInitAnimTree(SkelComp);
	RightArmIK = SkelControl_CCD_IK( mesh.FindSkelControl('RightArmIK') );
	LeftArmIK = SkelControl_CCD_IK( mesh.FindSkelControl('LeftArmIK') );
	RightWeaponRot = UDKSkelControl_LockRotation( mesh.FindSkelControl('RightWeaponRot'));
	LeftWeaponRot = UDKSkelControl_LockRotation( mesh.FindSkelControl('LeftWeaponRot'));
}

Any idea what I'm doing wrong here? Thanks as always.

Edit: Oh, and full disclosure: I haven't yet attached a gun to the left hand. If I can't figure that out, I'll ask about it in the future. Here's how I'm attaching the gun to the right hand, for now using a function in PlayerInput:

Code:
simulated exec function TestFunction1()
{
	local MyUnrealGameWeapon TheWeapon;
	local MyUnrealGamePawn ThePawn;
	ThePawn = MyUnrealGamePawn(Pawn);
	TheWeapon = ThePawn.Spawn(class'MyUnrealGameWeapon');
	TheWeapon.GiveTo(ThePawn);
}
 
Last edited:

Nathaniel3W

Member
Nov 11, 2012
48
0
6
Update: Elbows are bending correctly now and the hands are at variable distance from the body. The data I was getting from the Sixense was making really long vectors. I divided everything by 10 and now everything is going better. Still trying to point the gun though.
 

Nathaniel3W

Member
Nov 11, 2012
48
0
6
Well, I don't know if anyone can help me out with this. This is what I've been working on: http://www.youtube.com/watch?v=9_YSJYc0YDE. Sorry for the poor quality. This was filmed in the dark, after my kids went to bed, using whatever light and volume I could muster without waking them up.

I can rotate anything that is located at the mesh's WeaponPoint or DualWeaponPoint socket, but I can't rotate anything after it actually gets attached to the mesh at one of those sockets.
 

WormSlayer

New Member
May 12, 2004
7
0
0
Nice work there Nathaniel3W! I'd love to get a copy of your Hydra mod. I'm also awaiting a Rift devkit and brushing up* on my Unreal skills though I'm terribad at programming so sticking to the art and level design side of it.


* (Oh god... it's been so long: "Welcome, WormSlayer. You last visited: 13th May 2004 at 05:41 PM")
 

Nathaniel3W

Member
Nov 11, 2012
48
0
6
Ha! Welcome back. Since I got started on this project, I've made quite a bit of progress. I've also teamed up with a very knowledgeable project manager and a musician and now we're looking for artists and level designers.

If you're looking to work on your own project, that's great. I'll send you some code to get you started. Widespread adoption of a Hydra/Rift VR unit is good for all of us, after all. But if you want to get involved in what we're working on now, just send me a message through YouTube and I'll get you hooked up with everyone on the team.
 

dantesinferno

New Member
Mar 4, 2013
1
0
0
@Nathaniel3W Hey man your progress so far is awesome! I have been working on something similar and have been following online tutorials on udk/hydra intergration. I have the sixense dll in and all the playercontroller info in and all that jazz. I just have a few questions on pawn control and could use your help with code. If you don't mind. Maybe we could combine projects. I have a vr gun idea that is used alongside the razer hydra.

P.S.

I messaged you on youtube aswell under "monsta761"
 
Last edited:

Nathaniel3W

Member
Nov 11, 2012
48
0
6
Thanks VendorX, but I fixed it a long time ago. Ultimately what I ended up doing was chaining together some skeletal controllers. Single bone controller for the hands hooked up to a limb controller for the arms, hooked up to the AnimTree. (Right now I'm mentally singing that kids' song Dry Bones. I haven't thought of that song in years.)

SkelControlLimb requires more programming fuss than the SkelControl_CCDIK recommended in the tutorial I was following. But after setting the elbow axis and an elbow bending direction and some other stuff, I got that part working. SkelControlLimb looks much more crisp than CCDIK, which was intended for tentacles, not arms.

Another annoying problem that I ran into was that in UDK's SkelControlSingleBone, Apply Rotation is false by default. I clicked a check box and that let me rotate the hands and whatever is in them.
 

Nathaniel3W

Member
Nov 11, 2012
48
0
6
We haven't put anything up on our website yet, but if you're interested in working on it, you can always get a hold of me through YouTube. (I prefer that to typing out my Gmail address here.) We have a bit of working code and we're always looking for more people who are willing to contribute.