@@ -54,26 +54,26 @@ function ClientNodeEditor:__init()
54
54
[' Purple' ] = Vec4 (0.5 , 0 , 1 , 1 ),
55
55
[' Ray' ] = { Node = Vec4 (1 , 1 , 1 , 0.2 ), Line = { Vec4 (1 , 1 , 1 , 1 ), Vec4 (0 , 0 , 0 , 1 ) } },
56
56
[' Orphan' ] = { Node = Vec4 (0 , 0 , 0 , 0.5 ), Line = Vec4 (0 , 0 , 0 , 1 ) },
57
- { Node = Vec4 (1 , 0 , 0 , 0.25 ), Line = Vec4 (1 , 0 , 0 , 1 ) },
58
- { Node = Vec4 (1 , 0.55 , 0 , 0.25 ), Line = Vec4 (1 , 0.55 , 0 , 1 ) },
59
- { Node = Vec4 (1 , 1 , 0 , 0.25 ), Line = Vec4 (1 , 1 , 0 , 1 ) },
60
- { Node = Vec4 (0 , 0.5 , 0 , 0.25 ), Line = Vec4 (0 , 0.5 , 0 , 1 ) },
61
- { Node = Vec4 (0 , 0 , 1 , 0.25 ), Line = Vec4 (0 , 0 , 1 , 1 ) },
62
- { Node = Vec4 (0.29 , 0 , 0.51 , 0.25 ), Line = Vec4 (0.29 , 0 , 0.51 , 1 ) },
63
- { Node = Vec4 (1 , 0 , 1 , 0.25 ), Line = Vec4 (1 , 0 , 1 , 1 ) },
64
- { Node = Vec4 (0.55 , 0 , 0 , 0.25 ), Line = Vec4 (0.55 , 0 , 0 , 1 ) },
65
- { Node = Vec4 (1 , 0.65 , 0 , 0.25 ), Line = Vec4 (1 , 0.65 , 0 , 1 ) },
66
- { Node = Vec4 (0.94 , 0.9 , 0.55 , 0.25 ), Line = Vec4 (0.94 , 0.9 , 0.55 , 1 ) },
67
- { Node = Vec4 (0.5 , 1 , 0 , 0.25 ), Line = Vec4 (0.5 , 1 , 0 , 1 ) },
57
+ { Node = Vec4 (1 , 0 , 0 , 0.25 ), Line = Vec4 (1 , 0 , 0 , 1 ) },
58
+ { Node = Vec4 (1 , 0.55 , 0 , 0.25 ), Line = Vec4 (1 , 0.55 , 0 , 1 ) },
59
+ { Node = Vec4 (1 , 1 , 0 , 0.25 ), Line = Vec4 (1 , 1 , 0 , 1 ) },
60
+ { Node = Vec4 (0 , 0.5 , 0 , 0.25 ), Line = Vec4 (0 , 0.5 , 0 , 1 ) },
61
+ { Node = Vec4 (0 , 0 , 1 , 0.25 ), Line = Vec4 (0 , 0 , 1 , 1 ) },
62
+ { Node = Vec4 (0.29 , 0 , 0.51 , 0.25 ), Line = Vec4 (0.29 , 0 , 0.51 , 1 ) },
63
+ { Node = Vec4 (1 , 0 , 1 , 0.25 ), Line = Vec4 (1 , 0 , 1 , 1 ) },
64
+ { Node = Vec4 (0.55 , 0 , 0 , 0.25 ), Line = Vec4 (0.55 , 0 , 0 , 1 ) },
65
+ { Node = Vec4 (1 , 0.65 , 0 , 0.25 ), Line = Vec4 (1 , 0.65 , 0 , 1 ) },
66
+ { Node = Vec4 (0.94 , 0.9 , 0.55 , 0.25 ), Line = Vec4 (0.94 , 0.9 , 0.55 , 1 ) },
67
+ { Node = Vec4 (0.5 , 1 , 0 , 0.25 ), Line = Vec4 (0.5 , 1 , 0 , 1 ) },
68
68
{ Node = Vec4 (0.39 , 0.58 , 0.93 , 0.25 ), Line = Vec4 (0.39 , 0.58 , 0.93 , 1 ) },
69
69
{ Node = Vec4 (0.86 , 0.44 , 0.58 , 0.25 ), Line = Vec4 (0.86 , 0.44 , 0.58 , 1 ) },
70
70
{ Node = Vec4 (0.93 , 0.51 , 0.93 , 0.25 ), Line = Vec4 (0.93 , 0.51 , 0.93 , 1 ) },
71
- { Node = Vec4 (1 , 0.63 , 0.48 , 0.25 ), Line = Vec4 (1 , 0.63 , 0.48 , 1 ) },
72
- { Node = Vec4 (0.5 , 0.5 , 0 , 0.25 ), Line = Vec4 (0.5 , 0.5 , 0 , 1 ) },
73
- { Node = Vec4 (0 , 0.98 , 0.6 , 0.25 ), Line = Vec4 (0 , 0.98 , 0.6 , 1 ) },
71
+ { Node = Vec4 (1 , 0.63 , 0.48 , 0.25 ), Line = Vec4 (1 , 0.63 , 0.48 , 1 ) },
72
+ { Node = Vec4 (0.5 , 0.5 , 0 , 0.25 ), Line = Vec4 (0.5 , 0.5 , 0 , 1 ) },
73
+ { Node = Vec4 (0 , 0.98 , 0.6 , 0.25 ), Line = Vec4 (0 , 0.98 , 0.6 , 1 ) },
74
74
{ Node = Vec4 (0.18 , 0.31 , 0.31 , 0.25 ), Line = Vec4 (0.18 , 0.31 , 0.31 , 1 ) },
75
- { Node = Vec4 (0 , 1 , 1 , 0.25 ), Line = Vec4 (0 , 1 , 1 , 1 ) },
76
- { Node = Vec4 (1 , 0.08 , 0.58 , 0.25 ), Line = Vec4 (1 , 0.08 , 0.58 , 1 ) },
75
+ { Node = Vec4 (0 , 1 , 1 , 0.25 ), Line = Vec4 (0 , 1 , 1 , 1 ) },
76
+ { Node = Vec4 (1 , 0.08 , 0.58 , 0.25 ), Line = Vec4 (1 , 0.08 , 0.58 , 1 ) },
77
77
}
78
78
79
79
self .m_EventsReady = false
@@ -108,7 +108,7 @@ function ClientNodeEditor:OnRegisterEvents()
108
108
Console :Register (' Unlink' , ' Unlink two waypoints' , self , self ._onUnlinkNode )
109
109
Console :Register (' Merge' , ' Merge selected waypoints' , self , self ._onMergeNode )
110
110
Console :Register (' SelectPrevious' , ' Extend selection to previous waypoint' , self , self ._onSelectPrevious ) -- Done
111
- Console :Register (' ClearSelection' , ' Clear selection' , self , self ._onClearSelection ) -- Done
111
+ Console :Register (' ClearSelection' , ' Clear selection' , self , self ._onClearSelection ) -- Done
112
112
Console :Register (' Move' , ' toggle move mode on selected waypoints' , self , self ._onToggleMoveNode )
113
113
114
114
-- Add these Events to NodeEditor.
@@ -219,7 +219,6 @@ function ClientNodeEditor:_OnDrawNodes(p_NodesToDraw, p_UpdateView)
219
219
-- Clear last node.
220
220
self .m_LastDataPoint = nil
221
221
end
222
-
223
222
end
224
223
225
224
function ClientNodeEditor :_DrawData (p_DataPoint )
@@ -391,6 +390,8 @@ function ClientNodeEditor:GetDistance(p_Position1, p_Position2)
391
390
end
392
391
end
393
392
393
+ --- @param p_Position Vec3
394
+ --- @return nil
394
395
function ClientNodeEditor :FindNode (p_Position )
395
396
local s_ClosestNode = nil
396
397
local s_ClosestDistance = 0.6 -- Maximum 0.6 meter.
@@ -499,8 +500,8 @@ function ClientNodeEditor:_onToggleMoveNode(p_Args)
499
500
},
500
501
Other = {
501
502
{ Key = ' F12' , Name = ' Settings' },
502
- { Key = ' Q' , Name = ' Quick Select' },
503
- { Key = ' BS' , Name = ' Clear Select' },
503
+ { Key = ' Q' , Name = ' Quick Select' },
504
+ { Key = ' BS' , Name = ' Clear Select' },
504
505
{ Key = ' INS' , Name = ' Spawn Bot' }
505
506
}
506
507
})
@@ -543,10 +544,10 @@ function ClientNodeEditor:_onToggleMoveNode(p_Args)
543
544
{ Grid = ' K9' , Key = ' 9' , Name = ' Up' },
544
545
},
545
546
Other = {
546
- { Key = ' F12' , Name = ' Settings' },
547
- { Key = ' Q' , Name = ' Finish Move' },
548
- { Key = ' BS' , Name = ' Cancel Move' },
549
- { Key = ' KP_PLUS' , Name = ' Speed +' },
547
+ { Key = ' F12' , Name = ' Settings' },
548
+ { Key = ' Q' , Name = ' Finish Move' },
549
+ { Key = ' BS' , Name = ' Cancel Move' },
550
+ { Key = ' KP_PLUS' , Name = ' Speed +' },
550
551
{ Key = ' KP_MINUS' , Name = ' Speed -' },
551
552
}
552
553
})
@@ -893,7 +894,6 @@ function ClientNodeEditor:OnUpdateManagerUpdate(p_DeltaTime, p_UpdatePass)
893
894
894
895
-- Perform raycast to get where player is looking.
895
896
if self .m_EditMode == ' move' then
896
-
897
897
local s_Selection = self :GetSelectedNodes ()
898
898
899
899
if # s_Selection > 0 then
@@ -915,7 +915,6 @@ function ClientNodeEditor:OnUpdateManagerUpdate(p_DeltaTime, p_UpdatePass)
915
915
local s_UpdateData = {}
916
916
917
917
for i = 1 , # s_Selection do
918
-
919
918
local s_AdjustedPosition = self .m_EditNodeStartPos [s_Selection [i ].Node .ID ] + self .m_EditModeManualOffset
920
919
921
920
if self .m_EditPositionMode == ' relative' then
@@ -1024,6 +1023,9 @@ function ClientNodeEditor:DrawOBB(p_Aab, p_Transform, p_Color)
1024
1023
end
1025
1024
1026
1025
-- Stolen't https://github.com/EmulatorNexus/VEXT-Samples/blob/80cddf7864a2cdcaccb9efa810e65fae1baeac78/no-headglitch-raycast/ext/Client/__init__.lua
1026
+ --- @param p_MaxDistance number | nil
1027
+ --- @param p_UseAsync boolean | nil
1028
+ --- @return RayCastHit | nil
1027
1029
function ClientNodeEditor :Raycast (p_MaxDistance , p_UseAsync )
1028
1030
local s_Player = PlayerManager :GetLocalPlayer ()
1029
1031
if not s_Player then
@@ -1035,6 +1037,9 @@ function ClientNodeEditor:Raycast(p_MaxDistance, p_UseAsync)
1035
1037
-- We get the camera transform, from which we will start the raycast. We get the direction from the forward vector. Camera transform
1036
1038
-- is inverted, so we have to invert this vector.
1037
1039
local s_Transform = ClientUtils :GetCameraTransform ()
1040
+ if s_Transform == nil then
1041
+ return
1042
+ end
1038
1043
local s_Direction = Vec3 (- s_Transform .forward .x , - s_Transform .forward .y , - s_Transform .forward .z )
1039
1044
1040
1045
if s_Transform .trans == Vec3 .zero then
@@ -1051,6 +1056,7 @@ function ClientNodeEditor:Raycast(p_MaxDistance, p_UseAsync)
1051
1056
1052
1057
-- Perform raycast, returns a RayCastHit object.
1053
1058
1059
+ --- @type RayCastFlags
1054
1060
local s_Flags = RayCastFlags .DontCheckWater | RayCastFlags .DontCheckCharacter | RayCastFlags .DontCheckRagdoll |
1055
1061
RayCastFlags .CheckDetailMesh
1056
1062
0 commit comments