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
b057f217
Commit
b057f217
authored
5 years ago
by
Richard Marcus
Browse files
Options
Downloads
Patches
Plain Diff
snapzone spanws 90degree angle to the sky
parent
9baedaf6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Assets/FactManager.cs
+53
-0
53 additions, 0 deletions
Assets/FactManager.cs
Assets/InteractionEngine/CommunicationEvents.cs
+1
-1
1 addition, 1 deletion
Assets/InteractionEngine/CommunicationEvents.cs
Assets/InteractionEngine/WorldCursor.cs
+12
-3
12 additions, 3 deletions
Assets/InteractionEngine/WorldCursor.cs
with
66 additions
and
4 deletions
Assets/FactManager.cs
+
53
−
0
View file @
b057f217
...
...
@@ -22,6 +22,7 @@ void Start()
{
CommunicationEvents
.
ToolModeChangedEvent
.
AddListener
(
OnToolModeChanged
);
CommunicationEvents
.
TriggerEvent
.
AddListener
(
OnHit
);
CommunicationEvents
.
SnapEvent
.
AddListener
(
Rocket
);
//We dont want to have this here anymore...
//CommunicationEvents.RemoveFactEvent.AddListener(DeleteFact);
...
...
@@ -175,6 +176,42 @@ public void OnToolModeChanged(ToolMode ActiveToolMode)
}
}
//automatic 90 degree angle construction
public
void
Rocket
(
RaycastHit
hit
)
{
int
idA
,
idB
,
idC
;
//usual point
idA
=
this
.
GetFirstEmptyID
();
CommunicationEvents
.
AddFactEvent
.
Invoke
(
this
.
AddPointFact
(
hit
,
idA
));
//second point
idB
=
this
.
GetFirstEmptyID
();
var
shiftedHit
=
hit
;
var
playerPos
=
Camera
.
main
.
transform
.
position
;
playerPos
.
y
=
hit
.
point
.
y
;
shiftedHit
.
point
=
playerPos
;
CommunicationEvents
.
AddFactEvent
.
Invoke
(
this
.
AddPointFact
(
shiftedHit
,
idB
));
//third point with unknown height
idC
=
this
.
GetFirstEmptyID
();
var
skyHit
=
hit
;
skyHit
.
point
+=
Vector3
.
up
*
20
;
CommunicationEvents
.
AddFactEvent
.
Invoke
(
this
.
AddPointFact
(
skyHit
,
idC
));
//lines
CommunicationEvents
.
AddFactEvent
.
Invoke
(
this
.
AddLineFact
(
idA
,
idB
,
this
.
GetFirstEmptyID
()));
//lines
CommunicationEvents
.
AddFactEvent
.
Invoke
(
this
.
AddLineFact
(
idA
,
idC
,
this
.
GetFirstEmptyID
()));
//90degree angle
CommunicationEvents
.
AddFactEvent
.
Invoke
(
this
.
AddAngleFact
(
idB
,
idA
,
idC
,
GetFirstEmptyID
()));
}
public
void
OnHit
(
RaycastHit
hit
)
{
...
...
@@ -210,6 +247,22 @@ public void OnHit(RaycastHit hit)
}
}
//If no Point was hit
else
if
(
Input
.
GetKey
(
KeyCode
.
LeftShift
))
{
if
(
this
.
lineModeIsFirstPointSelected
)
{
//Event for end of line-drawing in "ShinyThings"
int
id
=
this
.
GetFirstEmptyID
();
CommunicationEvents
.
AddFactEvent
.
Invoke
(
this
.
AddPointFact
(
hit
,
id
));
CommunicationEvents
.
StopLineDrawingEvent
.
Invoke
(
null
);
//Create LineFact
CommunicationEvents
.
AddFactEvent
.
Invoke
(
this
.
AddLineFact
(
this
.
lineModeFirstPointSelected
.
Id
,
id
,
this
.
GetFirstEmptyID
()));
this
.
lineModeIsFirstPointSelected
=
false
;
this
.
lineModeFirstPointSelected
=
null
;
}
}
else
{
if
(
this
.
lineModeIsFirstPointSelected
)
...
...
This diff is collapsed.
Click to expand it.
Assets/InteractionEngine/CommunicationEvents.cs
+
1
−
1
View file @
b057f217
...
...
@@ -44,7 +44,7 @@ public class ShinyEvent : UnityEvent<Fact> {
public
static
HitEvent
SnapEvent
=
new
HitEvent
();
public
static
HitEvent
TriggerEvent
=
new
HitEvent
();
public
static
ToolModeEvent
ToolModeChangedEvent
=
new
ToolModeEvent
();
...
...
This diff is collapsed.
Click to expand it.
Assets/InteractionEngine/WorldCursor.cs
+
12
−
3
View file @
b057f217
...
...
@@ -72,9 +72,18 @@ void CheckMouseButtons(bool OnSnap=false)
if
(
Input
.
GetMouseButtonDown
(
0
))
{
if
(
EventSystem
.
current
.
IsPointerOverGameObject
())
return
;
//this prevents rays from shooting through ui
CommunicationEvents
.
TriggerEvent
.
Invoke
(
Hit
);
if
(
OnSnap
)
Hit
.
collider
.
enabled
=
false
;
if
(!
OnSnap
)
{
CommunicationEvents
.
TriggerEvent
.
Invoke
(
Hit
);
}
else
{
Hit
.
collider
.
enabled
=
false
;
CommunicationEvents
.
SnapEvent
.
Invoke
(
Hit
);
}
}
}
...
...
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