Skip to content

Commit

Permalink
Subscribe to correct tracker signals
Browse files Browse the repository at this point in the history
  • Loading branch information
Malcolmnixon committed Apr 22, 2024
1 parent 7abe0c6 commit 00f3dd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions scene/3d/xr_body_modifier_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ void XRBodyModifier3D::_process_modification() {
}
}

void XRBodyModifier3D::_tracker_changed(const StringName &p_tracker_name, const Ref<XRBodyTracker> &p_tracker) {
void XRBodyModifier3D::_tracker_changed(const StringName &p_tracker_name, XRServer::TrackerType p_tracker_type) {
if (tracker_name == p_tracker_name) {
_get_joint_data();
}
Expand All @@ -327,18 +327,18 @@ void XRBodyModifier3D::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
XRServer *xr_server = XRServer::get_singleton();
if (xr_server) {
xr_server->connect("body_tracker_added", callable_mp(this, &XRBodyModifier3D::_tracker_changed));
xr_server->connect("body_tracker_updated", callable_mp(this, &XRBodyModifier3D::_tracker_changed));
xr_server->connect("body_tracker_removed", callable_mp(this, &XRBodyModifier3D::_tracker_changed).bind(Ref<XRBodyTracker>()));
xr_server->connect("tracker_added", callable_mp(this, &XRBodyModifier3D::_tracker_changed));
xr_server->connect("tracker_updated", callable_mp(this, &XRBodyModifier3D::_tracker_changed));
xr_server->connect("tracker_removed", callable_mp(this, &XRBodyModifier3D::_tracker_changed));
}
_get_joint_data();
} break;
case NOTIFICATION_EXIT_TREE: {
XRServer *xr_server = XRServer::get_singleton();
if (xr_server) {
xr_server->disconnect("body_tracker_added", callable_mp(this, &XRBodyModifier3D::_tracker_changed));
xr_server->disconnect("body_tracker_updated", callable_mp(this, &XRBodyModifier3D::_tracker_changed));
xr_server->disconnect("body_tracker_removed", callable_mp(this, &XRBodyModifier3D::_tracker_changed).bind(Ref<XRBodyTracker>()));
xr_server->disconnect("tracker_added", callable_mp(this, &XRBodyModifier3D::_tracker_changed));
xr_server->disconnect("tracker_updated", callable_mp(this, &XRBodyModifier3D::_tracker_changed));
xr_server->disconnect("tracker_removed", callable_mp(this, &XRBodyModifier3D::_tracker_changed));
}
for (int i = 0; i < XRBodyTracker::JOINT_MAX; i++) {
joints[i].bone = -1;
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/xr_body_modifier_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class XRBodyModifier3D : public SkeletonModifier3D {
JointData joints[XRBodyTracker::JOINT_MAX];

void _get_joint_data();
void _tracker_changed(const StringName &p_tracker_name, const Ref<XRBodyTracker> &p_tracker);
void _tracker_changed(const StringName &p_tracker_name, XRServer::TrackerType p_tracker_type);
};

VARIANT_BITFIELD_CAST(XRBodyModifier3D::BodyUpdate)
Expand Down

0 comments on commit 00f3dd0

Please sign in to comment.