Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
WebXR Input Source: linear velocity #3060
WebXR Input Source: linear velocity #3060
Changes from 4 commits
8fa9d54
e77e169
f7af9e3
184acd9
b97ee8a
a5340f4
efbebef
cdc4076
5bbd9f7
517ea74
2aeb637
820a845
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have
RigidBodyComponent#linearVelocity
. Should this be a property too?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, but whole XR APIs uses function notation. Also it is only a get function, there is no way to set linear velocity as it is sourced from underlying APIs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it would just be a getter property. No requirement to have a setter. Functions are fine for
getPosition
/setPosition
etc to mirror the function onGraphNode
but generally, we should use properties where it makes sense.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to use properties, then all other methods would need to be changed for consistency reasons. Preferring a consistent design for WebXR APIs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The WebXR APIs shouldn't define their own API style. There should be an engine-wide style. If the WebXR APIs don't adhere to that, we can gradually migrate and alias to something that is consistent with the overall engine. Especially while the WebXR spec is in flux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used
get*
style which is in line withEntity
and other APIs. And as mentioned before, this is not settable property like in rigidbody's case.This particular method can be changed to match very specific case of rigidbody.
Then should we change:
getOrigin
andgetDirection
ofXrInputSource
to be similar toRay
, but again mentioning: origin and direction of input source cannot be set by developer, and provided by an API. Also they do call a function inside to update transform, just likeGraphNode.getPosition
does.And regarding
getPosition
andgetRotation
, should we change them to simply:position
androtation
?To be honest, it is already not consistent within engine, but it is very clear that if it is a property - then it can be set. In XR case, those methods cannot be set, they only provide data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a large number of gettable but not settable properties in the API. Just check out
GraphNode
for example:https://developer.playcanvas.com/en/api/pc.GraphNode.html#children
Read-only properties are 100% OK.
getPosition
andgetRotation
could be aliased toposition
androtation
maybe. I think it's a little complicated and needs some serious thought.TBH, we should probably improve
Ray
and have theXrInputSource
provide aRay
instead of separateorigin
anddirection
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can definitely start a discussion and do WebXR-wide refactor, with such changes. Some companies already using WebXR for development, and soon we need to consider backwards compatibility.
Development for Oculus Quest is already a commercially viable path.
Also developing for Chrome Android only - is commercially viable too.