- Home /
How to move a VR Object (Sword) with the Vive Controller but make it collide with walls etc?
Hello, i have a question about the VR Vive, i saw some tutorials and the easiest way to move a object with the vr controller is to set the controller as parent of the object, the object will move and rotate with the controller.
The sword has a rigidbody and a collider.
But the vive controller doesn't collide with anything (and shouldn't because you can't stop the player from moving the controller in real life and it would be weird). But this also means that if i put a sword as a child of the controller, it moves and rotates nice but if the player moves the controller into a object/wall the sword (or any other object) would still move with the parent and ignore any physics (I think because it's parented to the controller and just moves there?).
So my question is what would be a good way to move and rotate the sword with the controller but still let it collide with objects so for example when the player moves his controller into a wall the sword should stop at the wall and start to move with the controller again as soon as the player moves the controller out of the wall again.
I've seen some discussions about how you shouldn't stop the headset from moving, ever, because that's the easiest thing that could cause motion sickness. Although it won't cause motion sickness, I'm sure that making it so your held objects don't clip through walls isn't something most people would want since you would basically be telling them their hand stopped moving even though they know they moved it.
If you have problems with being able to attack enemies through walls or something, either make the walls thicker or only spawn the enemies right before you enter the room with them.
Hmm yes that's right, but for example if i want to block the sword attack with a shield, what would be the best solution? because since the player can move the controller where he wants, he can move it into/through the shield, but the shield should still block the attack, i think the only solution is to "stop" the sword at the shield? otherwise the player could ignore the shield and just move the sword into the shield an hit the enemy body
Well there's no other way of doing it that I can think of, basically because you can't stop the Vive Controller from moving
Answer by GamezAtWork · Nov 28, 2016 at 05:33 AM
Sorry if this answer is too late, but have you tried out NewtonVR? They have a pretty cool system for attaching items to your hand when you grab them, so that they will still be limited by collision when you swing them around.
Answer by Bisucousland · Jan 18, 2017 at 02:12 PM
Create a hinge at the point of impact. For example if i were to stab at a sheild the sword would simply rotate with the hand going up or down depending on where the controller is. If i were to hack at the sheild a smoother cutting motion would follow the hand.
Your answer