mirror of
https://github.com/BotChain-Robots/ui.git
synced 2026-07-08 15:07:22 +02:00
Added control library call in IK mode + camera focus on discover
This commit is contained in:
@@ -3,6 +3,8 @@ using UnityEngine;
|
||||
public class DiscoveryButton : MonoBehaviour
|
||||
{
|
||||
public TopologyBuilder topologyBuilder;
|
||||
[Tooltip("If set, camera focuses on GeneratedTopology after Discover. If null, will FindObjectOfType.")]
|
||||
public UserCameraControl cameraController;
|
||||
|
||||
void Start()
|
||||
{
|
||||
@@ -21,6 +23,7 @@ public class DiscoveryButton : MonoBehaviour
|
||||
{
|
||||
Debug.Log("Discovery button pressed.");
|
||||
topologyBuilder.BuildTopologyFromJson();
|
||||
FocusCameraOnTopology();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -28,6 +31,13 @@ public class DiscoveryButton : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
void FocusCameraOnTopology()
|
||||
{
|
||||
UserCameraControl cam = cameraController != null ? cameraController : FindObjectOfType<UserCameraControl>();
|
||||
if (cam != null)
|
||||
cam.FindModuleStructure();
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
Debug.Log("Cleaning up native resources");
|
||||
|
||||
Reference in New Issue
Block a user