Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
Unity World Storage Package
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ARF
World Storage API Helpers
Unity World Storage Package
Compare revisions
aa919a17df2a6203ce42ab2e4700c255936f940a to e34a64d96dc0e625955d30535e4b6df66651eb77
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
arf/world-storage-api-helpers/unity-world-storage-package
Select target project
No results found
e34a64d96dc0e625955d30535e4b6df66651eb77
Select Git revision
Branches
develop
features/demoIEEEVR
main
Tags
1.0.0
1.1.0
2.0.0
Swap
Target
arf/world-storage-api-helpers/unity-world-storage-package
Select target project
arf/world-storage-api-helpers/unity-world-storage-package
1 result
aa919a17df2a6203ce42ab2e4700c255936f940a
Select Git revision
Branches
develop
features/demoIEEEVR
main
Tags
1.0.0
1.1.0
2.0.0
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
Add a method to compute world pose of a node if it has no target
· fd9f1303
lacoche
authored
1 month ago
fd9f1303
Ping game object when generating virtual counterpart from graph editor window
· e34a64d9
lacoche
authored
1 month ago
e34a64d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Editor/Scripts/Windows/GraphEditorWindow.cs
+60
-17
60 additions, 17 deletions
Editor/Scripts/Windows/GraphEditorWindow.cs
with
60 additions
and
17 deletions
Editor/Scripts/Windows/GraphEditorWindow.cs
View file @
e34a64d9
...
...
@@ -33,6 +33,7 @@ using UnityEngine.UIElements;
using
TMPro
;
using
UnityEditor.Experimental.GraphView
;
using
System.Drawing.Drawing2D
;
using
System.Linq
;
namespace
ETSI.ARF.WorldStorage.Editor.Windows
{
...
...
@@ -609,7 +610,6 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
Vector3
position
;
Vector3
rotation
;
EstimateWorldPose
(
trackableNode
,
out
position
,
out
rotation
);
Debug
.
Log
(
"Position "
+
position
);
GenerateAndUpdateVisual
(
trackable
.
UUID
.
ToString
(),
"Trackable: "
+
trackable
.
TrackableType
+
" "
+
trackable
.
Name
,
position
,
rotation
,
true
);
// Todo : localCRS does not correspond to world pos
}
...
...
@@ -1352,31 +1352,74 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
visual
.
transform
.
SetPositionAndRotation
(
pos
,
Quaternion
.
Euler
(
rot
));
}
Selection
.
activeGameObject
=
visual
;
EditorGUIUtility
.
PingObject
(
visual
);
visual
.
transform
.
Find
(
"Canvas/Text"
).
GetComponent
<
TextMeshProUGUI
>().
text
=
$"Name:
{
name
}
\nUUID:
{
UUID
}
"
;
return
visual
;
}
/// Here is an approach to estimate the world pose of a node
/// It goes map depth and multiply the matrix of each link until it finds the last node considered as the origin (0, 0 ,0)
/// This is not the optimal method as it can create inconsistencies
/// A better approach would be to set the world poses of the nodes and then compute the matrix of the world links
private
void
EstimateWorldPose
(
ARFNode
node
,
out
Vector3
pos
,
out
Vector3
rot
)
{
// trackable
int
newNDepth
=
0
;
Matrix4x4
mat
=
Matrix4x4
.
identity
;
ComputePose
(
node
,
ref
mat
,
ref
newNDepth
);
// trackable
int
newNDepth
=
0
;
Matrix4x4
mat
=
Matrix4x4
.
identity
;
if
(
node
.
portIn
.
connections
.
Any
())
{
ComputePose
(
node
,
ref
mat
,
ref
newNDepth
);
}
else
{
// In case of no in link : just find the first output, find its generated game object an compute pose by composing with link
// not very optimal but firs approach
ComputePoseNoPortIn
(
node
,
out
mat
);
}
Vector3
translation
=
mat
.
GetColumn
(
3
);
// Extract Rotation
Quaternion
rotation
=
Quaternion
.
LookRotation
(
mat
.
GetColumn
(
2
),
mat
.
GetColumn
(
1
)
);
pos
=
translation
;
rot
=
rotation
.
eulerAngles
;
// Extract Rotation
Quaternion
rotation
=
Quaternion
.
LookRotation
(
mat
.
GetColumn
(
2
),
mat
.
GetColumn
(
1
)
);
pos
=
translation
;
rot
=
rotation
.
eulerAngles
;
}
private
void
ComputePoseNoPortIn
(
ARFNode
node
,
out
Matrix4x4
mat
)
{
mat
=
Matrix4x4
.
identity
;
foreach
(
Edge
edge
in
node
.
portOut
.
connections
)
{
// not best way : try to find an output node allready present in scene. Find gameobject pose and transform with link
ARFEdgeLink
arfEdge
=
(
ARFEdgeLink
)
edge
;
if
(
arfEdge
!=
null
)
{
WorldLink
link
=
arfEdge
.
worldLink
;
ARFNode
newNode
=
(
ARFNode
)
arfEdge
.
input
.
node
;
string
uuid
=
""
;
ARFNodeTrackable
trackNode
=
newNode
as
ARFNodeTrackable
;
ARFNodeWorldAnchor
worldNode
=
newNode
as
ARFNodeWorldAnchor
;
if
(
trackNode
!=
null
)
{
uuid
=
trackNode
.
trackable
.
UUID
.
ToString
()
;
}
else
{
uuid
=
worldNode
.
worldAnchor
.
UUID
.
ToString
()
;
}
GameObject
obj
=
GameObject
.
Find
(
uuid
);
// find associated gameobject (if it exists)
if
(
obj
!=
null
)
{
// compose matrix with link
mat
=
GetMatrix
(
link
.
Transform
).
inverse
*
obj
.
transform
.
localToWorldMatrix
;;
}
}
}
}
private
void
ComputePose
(
ARFNode
node
,
ref
Matrix4x4
mat
,
ref
int
depth
)
...
...
@@ -1396,8 +1439,6 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
{
Matrix4x4
newMat
=
GetMatrix
(
link
.
Transform
);
mat
=
mat
*
newMat
;
ARFNodeTrackable
trackNode
=
newNode
as
ARFNodeTrackable
;
ARFNodeWorldAnchor
worldNode
=
newNode
as
ARFNodeWorldAnchor
;
maxDepth
=
currentDepth
;
}
}
...
...
@@ -1405,6 +1446,8 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
depth
+=
maxDepth
;
}
private
Matrix4x4
GetMatrix
(
Transform3D
tr
)
{
Matrix4x4
matrix
=
new
Matrix4x4
();
...
...
This diff is collapsed.
Click to expand it.