XR Tracker reuses XR Pose
This commit is contained in:
parent
237bd0a615
commit
7d8a9d257d
|
@ -153,7 +153,13 @@ void XRPositionalTracker::invalidate_pose(const StringName &p_action_name) {
|
||||||
void XRPositionalTracker::set_pose(const StringName &p_action_name, const Transform3D &p_transform, const Vector3 &p_linear_velocity, const Vector3 &p_angular_velocity, const XRPose::TrackingConfidence p_tracking_confidence) {
|
void XRPositionalTracker::set_pose(const StringName &p_action_name, const Transform3D &p_transform, const Vector3 &p_linear_velocity, const Vector3 &p_angular_velocity, const XRPose::TrackingConfidence p_tracking_confidence) {
|
||||||
Ref<XRPose> new_pose;
|
Ref<XRPose> new_pose;
|
||||||
|
|
||||||
|
if (poses.has(p_action_name)) {
|
||||||
|
new_pose = poses[p_action_name];
|
||||||
|
} else {
|
||||||
new_pose.instantiate();
|
new_pose.instantiate();
|
||||||
|
poses[p_action_name] = new_pose;
|
||||||
|
}
|
||||||
|
|
||||||
new_pose->set_name(p_action_name);
|
new_pose->set_name(p_action_name);
|
||||||
new_pose->set_has_tracking_data(true);
|
new_pose->set_has_tracking_data(true);
|
||||||
new_pose->set_transform(p_transform);
|
new_pose->set_transform(p_transform);
|
||||||
|
@ -161,7 +167,6 @@ void XRPositionalTracker::set_pose(const StringName &p_action_name, const Transf
|
||||||
new_pose->set_angular_velocity(p_angular_velocity);
|
new_pose->set_angular_velocity(p_angular_velocity);
|
||||||
new_pose->set_tracking_confidence(p_tracking_confidence);
|
new_pose->set_tracking_confidence(p_tracking_confidence);
|
||||||
|
|
||||||
poses[p_action_name] = new_pose;
|
|
||||||
emit_signal(SNAME("pose_changed"), new_pose);
|
emit_signal(SNAME("pose_changed"), new_pose);
|
||||||
|
|
||||||
// TODO discuss whether we also want to create and emit an InputEventXRPose event
|
// TODO discuss whether we also want to create and emit an InputEventXRPose event
|
||||||
|
|
Loading…
Reference in New Issue