Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UFrameIT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FrameIT
UFrameIT
Commits
bacdce81
Commit
bacdce81
authored
2 years ago
by
Tobias Schöner
Browse files
Options
Downloads
Patches
Plain Diff
Added snapping to circle
parent
aa6e4878
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
feat: added visualisation for CircleFact; added Torus- and ConeGenerator
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Assets/Scripts/InteractionEngine/WorldCursor.cs
+24
-1
24 additions, 1 deletion
Assets/Scripts/InteractionEngine/WorldCursor.cs
with
24 additions
and
1 deletion
Assets/Scripts/InteractionEngine/WorldCursor.cs
+
24
−
1
View file @
bacdce81
...
...
@@ -166,7 +166,6 @@ void Update()
else
if
(
multipleHits
[
i
].
collider
.
gameObject
.
layer
==
LayerMask
.
NameToLayer
(
"Ring"
))
{
#
region
Ring
Debug
.
Log
(
"PRINT"
);
var
id
=
multipleHits
[
i
].
transform
.
GetComponent
<
FactObject
>().
URI
;
CircleFact
circleFact
=
StageStatic
.
stage
.
factState
[
id
]
as
CircleFact
;
Vector3
middlePoint
=
((
PointFact
)
StageStatic
.
stage
.
factState
[
circleFact
.
Pid1
]).
Point
;
...
...
@@ -192,6 +191,7 @@ void Update()
var
direction
=
(
pPlane
-
middlePoint
).
normalized
;
multipleHits
[
i
].
point
=
middlePoint
+
direction
*
radius
;
}
// cursor orientation should match circle orientation; dont face downwards
if
(
normal
.
y
<
0
)
// if normal faces downwards use inverted normal instead
multipleHits
[
i
].
normal
=
-
normal
;
...
...
@@ -199,6 +199,29 @@ void Update()
multipleHits
[
i
].
normal
=
normal
;
#
endregion
Ring
}
else
if
(
multipleHits
[
i
].
collider
.
gameObject
.
layer
==
LayerMask
.
NameToLayer
(
"Circle"
))
{
#
region
Circle
var
id
=
multipleHits
[
i
].
transform
.
GetComponent
<
FactObject
>().
URI
;
CircleFact
circleFact
=
StageStatic
.
stage
.
factState
[
id
]
as
CircleFact
;
Vector3
middlePoint
=
((
PointFact
)
StageStatic
.
stage
.
factState
[
circleFact
.
Pid1
]).
Point
;
Vector3
edgePoint
=
((
PointFact
)
StageStatic
.
stage
.
factState
[
circleFact
.
Pid2
]).
Point
;
var
normal
=
circleFact
.
normal
;
var
radius
=
circleFact
.
radius
;
// project p on circlePlane
var
q
=
multipleHits
[
i
].
point
-
middlePoint
;
var
dist
=
Vector3
.
Dot
(
q
,
normal
);
var
pPlane
=
multipleHits
[
i
].
point
-
(
normal
*
dist
);
// p on circlePlane
multipleHits
[
i
].
point
=
pPlane
;
// cursor orientation should match circle orientation; dont face downwards
if
(
normal
.
y
<
0
)
// if normal faces downwards use inverted normal instead
multipleHits
[
i
].
normal
=
-
normal
;
else
multipleHits
[
i
].
normal
=
normal
;
#
endregion
Circle
}
else
{
multipleHits
[
i
].
point
=
multipleHits
[
i
].
collider
.
transform
.
position
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment