- Home /
2 hand weapons, using dynamic hands with the razer hydra controllers
Hello. I'm using the razer hydra motion controllers to control two hands. I've been working with one handed weapons which are working fine, but when it comes to using a 2 hand weapon that goes from the left hand to the right hand, I can't figure out how to do it. Basically the sword will have the transform.position of the left hand, with the sword/handle sticking through the position of the right hand, so basically the rotation of the sword would be the position of the right hand.
I've been trying to get RotateTowards to do what I'm trying to achieve, but I can't get it to work, and I'm wondering if it's possible to do this through bones, or having two piviot points on the sword or something. I'm a bit clueless on this task, so any help or guidance is greatly appreciated. As long as I know which method I should use, I should be able to figure this out.
Thanks in Advance
Edit.
more information:
Hi there, I'll try and be a bit more specific. For those of you who are not familiar with the razer hydra controllers, take a look at this link: http://www.youtube.com/watch?v=l714RhwpA28 if you skip to 1 minute inn, you'll see how he's controlling the 2 handed gun with both hands, and I'm trying to do the same, but with a 2 hand weapon instead. Doing this with a one hander was just a matter of parenting the sword to hand, and set the rotation and the position:
sword.transform.parent=LeftHand.transform;
sword.transform.rotation= LeftHand.transform.rotation;
and the sword would automatically map to the hand this way. However I can't figure out how to do the same with a 2 hander, at the moment I've been trying to get RotateTowards to work:
_direction = (RightHand.transform.position-LeftHand.transform.position);
Vector3 newDir = Vector3.RotateTowards(transform.forward, _direction, 50, 50);
transform.rotation = Quaternion.LookRotation(newDir);
But this is not working correctly this is the first time I'm trying to use the RotateTowerds function, so I might not be using it the right way either. So I was wondering if there's another method I should try and use. Sorry if my explanation is a bit vague, but I'm not sure how to explain what I want to achieve in any other way
the commenting section is bugged for me at the moment, so I'll post my comment here:
Is there anyone who knows anything about this matter? I'm really stuck, and I'm not asking for much, I just need to know which methods I could try to achieve what I'm trying to do. Thanks again
can you give us more details?
like your code?
but basicly you need to verify if you have something in Lhand if if you do than put in right hand.
so you need an IF statement.
Your answer
Follow this Question
Related Questions
String segment comparator 1 Answer
2 Programming Languages 4 Answers
How to make a button go through Gameobjects one at a time.? 0 Answers