Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VR controllers have collision issues #69363

Open
Blockyheadman opened this issue Nov 30, 2022 · 4 comments
Open

VR controllers have collision issues #69363

Blockyheadman opened this issue Nov 30, 2022 · 4 comments

Comments

@Blockyheadman
Copy link

Godot version

3.5.1-stable

System information

Android

Issue description

On my Quest 2 Android release of a game I'm trying to make, the controllers don't follow the position its tracked to. I'm using a rigid body so i can add collisions to the controller. it just snaps away from the controllers over time when you lose tracking. Is it possible to make it so we can have collisions for XR Controllers.

Steps to reproduce

make an xr controller, add rigid bodies to the controllers, get result.

Minimal reproduction project

https://drive.google.com/uc?id=1PjT8C8J2kkKQ-e1uPNg1F7f6Y9_kL3iA&export=download

@Calinou
Copy link
Member

Calinou commented Dec 1, 2022

cc @BastiaanOlij

I don't think you're supposed to have actual XR controllers as RigidBodies, as these move around erratically as opposed to having a smooth motion.

@Blockyheadman
Copy link
Author

Well I didn't have the controllers under a rigidbody but rather I had the rigid body under the xrcontroller

@BastiaanOlij
Copy link
Contributor

BastiaanOlij commented Dec 2, 2022

@Blockyheadman ok this one is very tricky.

XRController is a node that follows the physical location of your hand in relation to a central point in space (the XROrigin3D node).

A RigidBody3D is a physics node whose position is controlled by the physics engine using the velocity of the object, the physics engine tests for collisions along this movement path.

Combining the two does not give you the behavior you're asking for. The rigidbody is still governed by it's velocity, which will slowly increase as gravity is applied and the body will fall away from the hand.
At the same time the XRController being its parent will also add the movement of the hand to the rigidbody however as this movement is performed outside of the physics engine, no collisions are tested.

This is not a bug in the system or an issue with Godot, it is expecting a behavior from objects that aren't designed for this. They are doing exactly what they are supposed to do.

If you want a physics body to follow the controller, and either push objects your hand pushes against, or stop movement of the hand when it encounters a static body, then that is behavior you will need to build by having a collision body follow the movement of the hands. It is not a feature that comes out of the box with Godot, it is also a feature that has a level of complexity and specificity to XR that it likely won't become a core feature, it is something that would be implemented differently among different games.

That said, over at the Godot XR discord channel several of us are working on different solutions, some of which we're adding into our XR Tools library. We haven't cracked the egg yet to make this work to the extent that say boneworks does, but depending on your goals there are several solutions that may meet your needs.

My best advise is to come hang out there and ask what others are doing to implement the behavior you're after or check out the tools library and see if it already has a solution for what you need.

@Blockyheadman
Copy link
Author

Alrighty. Thanks man. I'll check it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants