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

expose XRInterface::get_transform_for_view to gdscript #68390

Merged
merged 1 commit into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions doc/classes/XRInterface.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@
Returns an array of vectors that denotes the physical play area mapped to the virtual space around the [XROrigin3D] point. The points form a convex polygon that can be used to react to or visualize the play area. This returns an empty array if this feature is not supported or if the information is not yet available.
</description>
</method>
<method name="get_projection_for_view">
<return type="Projection" />
<param index="0" name="view" type="int" />
<param index="1" name="aspect" type="float" />
<param index="2" name="near" type="float" />
<param index="3" name="far" type="float" />
<description>
Returns the projection matrix for a view/eye.
</description>
</method>
<method name="get_render_target_size">
<return type="Vector2" />
<description>
Expand All @@ -47,6 +57,16 @@
If supported, returns the status of our tracking. This will allow you to provide feedback to the user whether there are issues with positional tracking.
</description>
</method>
<method name="get_transform_for_view">
<return type="Transform3D" />
<param index="0" name="view" type="int" />
<param index="1" name="cam_transform" type="Transform3D" />
<description>
Returns the transform for a view/eye.
[param view] is the view/eye index.
[param cam_transform] is the transform that maps device coordinates to scene coordinates, typically the global_transform of the current XROrigin3D.
</description>
</method>
<method name="get_view_count">
<return type="int" />
<description>
Expand Down
2 changes: 2 additions & 0 deletions servers/xr/xr_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ void XRInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_passthrough_enabled"), &XRInterface::is_passthrough_enabled);
ClassDB::bind_method(D_METHOD("start_passthrough"), &XRInterface::start_passthrough);
ClassDB::bind_method(D_METHOD("stop_passthrough"), &XRInterface::stop_passthrough);
ClassDB::bind_method(D_METHOD("get_transform_for_view", "view", "cam_transform"), &XRInterface::get_transform_for_view);
ClassDB::bind_method(D_METHOD("get_projection_for_view", "view", "aspect", "near", "far"), &XRInterface::get_projection_for_view);
dsnopek marked this conversation as resolved.
Show resolved Hide resolved

ADD_GROUP("AR", "ar_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ar_is_anchor_detection_enabled"), "set_anchor_detection_is_enabled", "get_anchor_detection_is_enabled");
Expand Down