diff --git a/API/oursin/neurons.py b/API/oursin/neurons.py index 792437e0..16ea8461 100644 --- a/API/oursin/neurons.py +++ b/API/oursin/neurons.py @@ -298,7 +298,7 @@ def set_shapes(neurons_list, shapes_list): for i in range(len(neurons_list)): neuron = neurons_list[i] if neuron.in_unity: - neurons_shapes[neuron.id] = utils.sanitize_shape(shapes_list[i]) + neurons_shapes[neuron.id] = shapes_list[i] else: warnings.warn(f"Neuron with id {neuron.id} does not exist in Unity, call create method first.") client.sio.emit('SetNeuronShape', neurons_shapes) diff --git a/UnityClient/Assets/Prefabs/Objects/PrimitiveMeshRenderer.prefab b/UnityClient/Assets/Prefabs/Objects/PrimitiveMeshRenderer.prefab index a6930200..c972932d 100644 --- a/UnityClient/Assets/Prefabs/Objects/PrimitiveMeshRenderer.prefab +++ b/UnityClient/Assets/Prefabs/Objects/PrimitiveMeshRenderer.prefab @@ -27,7 +27,7 @@ Transform: m_GameObject: {fileID: 4726930313454754357} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} @@ -61,7 +61,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + - {fileID: 2100000, guid: 81bfceea20b892d44b814a1db0c2e7de, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 diff --git a/UnityClient/Assets/Scenes/UnityMouseRenderer.unity b/UnityClient/Assets/Scenes/UnityMouseRenderer.unity index a207fabf..a5e48aaf 100644 --- a/UnityClient/Assets/Scenes/UnityMouseRenderer.unity +++ b/UnityClient/Assets/Scenes/UnityMouseRenderer.unity @@ -2835,6 +2835,37 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 803296948} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &805664570 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 805664571} + m_Layer: 6 + m_Name: Primitives + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &805664571 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 805664570} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 5.7, y: 4, z: -6.6} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1690469968} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &818490703 GameObject: m_ObjectHideFlags: 0 @@ -7421,6 +7452,7 @@ Transform: - {fileID: 681682131} - {fileID: 3977901844913398025} - {fileID: 1500345431} + - {fileID: 805664571} m_Father: {fileID: 1495091484} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -11144,6 +11176,10 @@ PrefabInstance: propertyPath: m_RootOrder value: 6 objectReference: {fileID: 0} + - target: {fileID: 5708727189844022269, guid: 819c72893569fa442b7683567f3569d6, type: 3} + propertyPath: _primitiveMeshParentT + value: + objectReference: {fileID: 805664571} - target: {fileID: 5708727191346960128, guid: 819c72893569fa442b7683567f3569d6, type: 3} propertyPath: m_Name value: Lines diff --git a/UnityClient/Assets/Scripts/Managers/PrimitiveMeshManager.cs b/UnityClient/Assets/Scripts/Managers/PrimitiveMeshManager.cs index 69bf2e1d..184ac030 100644 --- a/UnityClient/Assets/Scripts/Managers/PrimitiveMeshManager.cs +++ b/UnityClient/Assets/Scripts/Managers/PrimitiveMeshManager.cs @@ -7,12 +7,10 @@ public class PrimitiveMeshManager : MonoBehaviour { //Keeping a dictionary mapping names of objects to the game object in schene private Dictionary _primMeshRenderers; - //log warning if string id alr exists (containskey()) - //send warning back to python - //Client.logwarning("message"); [SerializeField] private GameObject _cubePrefab; [SerializeField] private List _materials; [SerializeField] private List _materialNames; + [SerializeField] private Transform _primitiveMeshParentT; private Dictionary _materialDictionary; private void Awake() @@ -26,11 +24,6 @@ private void Awake() _materialDictionary.Add(_materialNames[i], _materials[i]); } - } - // Start is called before the first frame update - void Start() - { - } public void CreateMesh(List meshes) //instantiates cube as default @@ -40,7 +33,7 @@ void Start() if (_primMeshRenderers.ContainsKey(mesh)) Client.LogWarning($"Mesh with id = {mesh} already exists."); - GameObject tempObject = Instantiate(_cubePrefab); + GameObject tempObject = Instantiate(_cubePrefab, _primitiveMeshParentT); tempObject.name = $"primMesh_{mesh}"; _primMeshRenderers.Add(mesh, tempObject.GetComponent()); tempObject.GetComponent().material = _materialDictionary["default"]; @@ -63,23 +56,13 @@ public void DeleteMesh(List meshes) public void SetPosition(Dictionary> meshPositions) { foreach (string meshName in meshPositions.Keys) - {// running through whole dictionary: - //if (_primMeshRenderers.ContainsKey(meshName)) - //Client.LogWarning($"Mesh with id = {meshName} does not exist."); - + { List data = meshPositions[meshName]; Vector3 position = new Vector3 (data[0], data[1], data[2]); - - //CHECK IF KEY MESH NAME EXISTS (IF NOT SEND WARNING) MeshRenderer tempMesh = _primMeshRenderers[meshName]; - // Example of how a CoordinateSpace could be used to position this mesh - // CCFSpace tempCoordinateSpace = new CCFSpace(); - // Example 1: User passed coordinates in CCF space - // Vector3 positionWorld = tempCoordinateSpace.Space2World(position); - - tempMesh.transform.position = position; + tempMesh.transform.localPosition = new Vector3(-position[0] / 1000f, -position[2] / 1000f, position[1] / 1000f); } }