-
Notifications
You must be signed in to change notification settings - Fork 3
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
Feature/visualizing snapzone content in editor trng 1047 #47
Feature/visualizing snapzone content in editor trng 1047 #47
Conversation
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 know it is already messed up, but maybe some new public elements from the SnapZone (like the PreviewMesh) can be internals.
|
||
private void Update() | ||
{ | ||
bool isPreviewing = gameObject.GetComponent<MeshFilter>() != 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.
Perhaps the MeshFilter can be cached and just check if it is null or not.
if (Parent.ShowHighlightInEditor && Parent.PreviewMesh && isPreviewing == false) | ||
{ | ||
MeshFilter meshFilter = gameObject.AddComponent<MeshFilter>(); | ||
meshFilter.sharedMesh = Parent.PreviewMesh; |
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.
Does this work if the parent has a SkinnedMeshRenderer?
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.
dont know :x
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 think it should, I'll test it
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.
It does work
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.
Also fixed the highlight during runtime. |
Runtime/Interaction/SnapZone.cs
Outdated
|
||
private Material highlightMeshMaterial; | ||
[SerializeField] |
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.
publics are already serialized 😇
@@ -318,6 +384,14 @@ public override bool CanSelect(XRBaseInteractable interactable) | |||
return true; | |||
} | |||
|
|||
foreach (Validator validator in validators) |
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 (validators.All(validator => validator.Validate(interactable.gameObject)) == false)
{
return false;
}
I didn't test it yet, but the code looks OK |
When |
@@ -54,8 +55,25 @@ private void CreateSnapZone(SnappableProperty snappable) | |||
// Adds a Snap Zone component to our new object. | |||
SnapZone snapZone = snapObject.AddComponent<SnapZoneProperty>().SnapZone; | |||
snapZone.ShownHighlightObject = snapZonePrefab; | |||
IsTrainingSceneObjectValidation validation = | |||
snapZone.gameObject.AddComponent<IsTrainingSceneObjectValidation>(); |
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.
linebreak. maybe you dont want that
@@ -31,24 +31,39 @@ public class SnapZoneSettings : ScriptableObject | |||
private Material highlightMaterial; | |||
|
|||
/// <summary> | |||
/// This color is used when an <see cref="InteractableObject"/> is hovering a <see cref="SnapZone"/>. | |||
/// This color is used when a valid <see cref="InteractableObject"/> is hovering a <see cref="SnapZone"/>. |
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.
ValidationColor probably should be ValidColor since it is also InvalidColor.
Validation is the process and therefore could also be invalid in the end
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.
should probably be that, but this is an api break :|
/// <summary> | ||
/// The material used for drawing when an <see cref="InteractableObject"/> is hovering a <see cref="SnapZone"/>. Should be transparent. | ||
/// </summary> | ||
public Material HighlightMaterial => SetupHighlightMaterial(); | ||
|
||
/// <summary> | ||
/// The material used for the highlight object. Should be transparent. | ||
/// The material used for the highlight object, when a valid object is hovering. Should be transparent. |
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.
Same as with the color -> ValidMaterial or IsValidMaterial
e4c6613
to
ca164d2
Compare
feat(snapzones): added gizmo to snapzones feat(snapzones): automatically created snapzones only snap the correct object fix(snapzones): snapping not working correctly with offset items fix(snapzones): improved rendering of highlights for snapzones fix(snapzones): fast forward snappables now snap immediately (#44)
ca164d2
to
1e5d783
Compare
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.
By the power vested in me, I now pronounce this PR, approved!
You may now merge the branch.
🎉 This PR is included in version 1.3.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
Fixes: # (issue)
Type of change
How Has This Been Tested?
by hand
Test Configuration:
To get this working you also have to checkout Basic interaction: Feature/validation for snapzones