-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat(Pointer): pointer implementation #86
Conversation
Down the line:
See #90. |
Scripts/Cast/ParabolicLineCast.cs
Outdated
/// prevent the cast being projected high into the sky and curving back down. | ||
/// </summary> | ||
[Tooltip("The maximum angle in degrees of the origin before the cast curve height is restricted. A lower angle setting will prevent the cast being projected high into the sky and curving back down.")] | ||
[Range(1, 100)] |
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.
[Tooltip()]
should be the last attribute before the parameter
/// <summary>
/// The maximum angle in degrees of the origin before the cast curve height is restricted. A lower angle setting will
/// prevent the cast being projected high into the sky and curving back down.
/// </summary>
[Range(1, 100)]
[Tooltip("The maximum angle in degrees of the origin before the cast curve height is restricted. A lower angle setting will prevent the cast being projected high into the sky and curving back down.")]
public float heightLimitAngle = 100f;
Scripts/Cast/ParabolicLineCast.cs
Outdated
AdjustForEarlyCollisions(jointPosition, downPosition); | ||
} | ||
|
||
protected virtual Vector3 ProjectForwardBeam() |
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.
Protected methods also need XML docs
Scripts/Cast/PointsCast.cs
Outdated
/// <summary> | ||
/// The result of the most recent cast. <see langword="null"/> when the cast didn't hit anything. | ||
/// </summary> | ||
public RaycastHit? TargetHit; |
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.
field should be targetHit
Also why have RaycastHit
nullable type? can't you just check RaycastHit.transform == null
?
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.
Nullable because I don't want the intrinsic knowledge of how Unity uses RaycastHit
to be part of this - they could change that, too (but probably won't). This way a user just has to test for existence, rather than know about how RaycastHit
handles its properties to signal "nothing was hit".
Scripts/Cast/PointsCast.cs
Outdated
/// <summary> | ||
/// The points along the the most recent cast. | ||
/// </summary> | ||
public IReadOnlyList<Vector3> Points; |
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.
points
Scripts/Cast/PointsCast.cs
Outdated
/// An optional <see cref="ExclusionRule"/> to determine targets based on the set rules. | ||
/// </summary> | ||
[Tooltip("An optional ExclusionRule to determine targets based on the set rules.")] | ||
public ExclusionRule exclusionRule; |
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.
this is called targetValidity
elsewhere
Scripts/Pointer/PointerSelection.cs
Outdated
{ | ||
using UnityEngine; | ||
|
||
public class PointerSelection : MonoBehaviour |
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.
docs
@@ -3,6 +3,7 @@ | |||
using UnityEngine; | |||
using UnityEngine.Events; | |||
using System; | |||
using VRTK.Core.Cast; |
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.
why does this need Cast
?
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.
As specified in the commit message (and the PR description):
Additionally the introduction of more components that raycast means
the existingPhysicsCast
class is moved to the new namespace
Cast
.
These other classes are referencing PhysicsCast
that now lives in that other namespace.
Scripts/Pointer/StraightPointer.cs
Outdated
@@ -1,7 +1,7 @@ | |||
namespace VRTK.Core.Pointer | |||
{ | |||
using UnityEngine; | |||
using VRTK.Core.Utility; | |||
using VRTK.Core.Cast; |
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.
why does this need Cast
?
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.
See my other comment: These other classes are referencing PhysicsCast
that now lives in that other namespace.
{ | ||
using UnityEngine; | ||
|
||
public static class BezierCurveGenerator |
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.
docs blitz
Scripts/Cast/ParabolicLineCast.cs
Outdated
/// the downward cast. | ||
/// </summary> | ||
[Tooltip("The maximum length of the projected cast. The x value is the length of the forward cast, the y value is the length of the downward cast.")] | ||
public Vector2 maximumLength = new Vector2(10f, float.PositiveInfinity); |
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.
This is going to inherit the existing problem with the bezier pointer cast (i will attempt to explain with MSPaint obvs)
Limited cast:
(Down doesnt reach floor so not valid target)
Simply angling the forward cast beam down means you can now reach the floor
There is an open bug for this issue:
ExtendRealityLtd/VRTK#1288
No viable solution as of yet (maybe it relies on rotation of beam? or always does a forward beam in world forward for working out viability of downward length?)
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.
Moved this into #89.
565bc31
to
1142693
Compare
I did the requested changes and added a comment explaining Cast
namespace change.
116d342
to
1cf96c8
Compare
The pointer concept is the ability to designate an area of the scene with a destination. A pointer consists of multiple independent functionality which is implemented through a component that casts and returns points that define the pointer beam, one that generically renders points via game objects and a third component handles the selection functionality of a pointer. A pointer knows when it is activated, deactivated, when it starts hovering (enters) a new object, when it finishes hovering (exits) an object and knows what coordinates of the object it is hovering over. These are all cast as events with a special pointer payload containing information about the pointer target. The Straight Line Cast implementation casts a straight line from an origin point (e.g. controller) and stops when it collides with an object (or reaches the set maximum length). The same applies to the added Parabolic Line Cast, but it casts a parabolic line instead. Additionally the introduction of more components that raycast means the existing `PhysicsCast` class is moved to the new namespace `Cast`.
superseded by #95 |
The pointer concept is the ability to designate an area of the scene
with a destination. A pointer consists of multiple independent
functionality which is implemented through a component that casts
and returns points that define the pointer beam, one that
generically renders points via game objects and a third component
handles the selection functionality of a pointer.
A pointer knows when it is activated, deactivated, when it starts
hovering (enters) a new object, when it finishes hovering (exits) an
object and knows what coordinates of the object it is hovering over.
These are all cast as events with a special pointer payload
containing information about the pointer target.
The Straight Line Cast implementation casts a straight line from an
origin point (e.g. controller) and stops when it collides with an
object (or reaches the set maximum length). The same applies to the
added Parabolic Line Cast, but it casts a parabolic line instead.
Additionally the introduction of more components that raycast means
the existing
PhysicsCast
class is moved to the new namespaceCast
.