Physics ant
This commit is contained in:
parent
76c5372089
commit
fd7359acd0
@ -24,13 +24,13 @@ public class ClusterInspector : Editor {
|
||||
serializedObject.Update();
|
||||
|
||||
VisualElement root = new();
|
||||
CreateInspector(root, prefab, prefab.output);
|
||||
CreateInspector(root, prefab, prefab.output, null);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
return root;
|
||||
}
|
||||
|
||||
public static GraphView CreateInspector(VisualElement root, ClusterPrefab cluster, Nucleus output) {
|
||||
public static GraphView CreateInspector(VisualElement root, ClusterPrefab cluster, Nucleus output, GameObject gameObject) {
|
||||
root.style.paddingLeft = 0;
|
||||
root.style.paddingRight = 0;
|
||||
root.style.paddingTop = 0;
|
||||
@ -61,7 +61,7 @@ public class ClusterInspector : Editor {
|
||||
mainContainer.Add(inspectorContainer);
|
||||
root.Add(mainContainer);
|
||||
|
||||
graph.SetGraph(null, output, inspectorContainer);
|
||||
graph.SetGraph(gameObject, output, inspectorContainer);
|
||||
|
||||
return graph;
|
||||
}
|
||||
@ -593,7 +593,8 @@ public class ClusterInspector : Editor {
|
||||
Vector3 value = synapse.nucleus.outputValue * synapse.weight;
|
||||
GUIContent synapseValueLabel = new(synapse.nucleus.name, synapse.nucleus.outputValue.ToString());
|
||||
EditorGUILayout.FloatField(synapseValueLabel, length(synapse.nucleus.outputValue));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField(synapse.nucleus.name);
|
||||
if (GUILayout.Button("Disconnect"))
|
||||
@ -671,6 +672,7 @@ public class ClusterInspector : Editor {
|
||||
void OnSceneGUI(SceneView sceneView) {
|
||||
if (this.gameObject != null) {
|
||||
Vector3 worldVector = this.gameObject.transform.TransformVector(this.currentNucleus.outputValue);
|
||||
// worldVector = worldVector.normalized;
|
||||
Handles.color = Color.yellow;
|
||||
Handles.DrawLine(this.gameObject.transform.position, this.gameObject.transform.position + worldVector);
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ public class NanoBrainComponent_Editor : Editor {
|
||||
|
||||
|
||||
VisualElement root = new();
|
||||
ClusterInspector.CreateInspector(root, brain.prefab, brain.output);
|
||||
ClusterInspector.CreateInspector(root, brain.prefab, brain.output, component.gameObject);
|
||||
|
||||
if (Application.isPlaying == false)
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user