public DCLBuilderInWorldEntity GetEntityOnPointer() { RaycastHit hit; UnityEngine.Ray ray; float distanceToSelect = distanceLimitToSelectObjects; if (!isAdvancedModeActive) { ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0)); } else { ray = Camera.main.ScreenPointToRay(Input.mousePosition); distanceToSelect = 9999; } if (Physics.Raycast(ray, out hit, distanceToSelect, layerToRaycast)) { string entityID = hit.collider.gameObject.name; if (sceneToEdit.entities.ContainsKey(entityID)) { return(builderInWorldEntityHandler.GetConvertedEntity(sceneToEdit.entities[entityID])); } } return(null); }
public void EntityDuplicate() { DecentralandEntity duplicateEntity = entityHandler.DuplicateEntity(entity); DCLBuilderInWorldEntity convertedEntity = entityHandler.GetConvertedEntity(duplicateEntity); Assert.IsNotNull(convertedEntity); }
public void EntityDuplicate() { IDCLEntity duplicateEntity = entityHandler.DuplicateEntity(entity).rootEntity; DCLBuilderInWorldEntity convertedEntity = entityHandler.GetConvertedEntity(duplicateEntity); Assert.IsNotNull(convertedEntity); }
public DCLBuilderInWorldEntity GetEntityOnPointer() { RaycastHit hit; UnityEngine.Ray ray = Camera.main.ScreenPointToRay(biwModeController.GetMousePosition()); float distanceToSelect = biwModeController.GetMaxDistanceToSelectEntities(); if (Physics.Raycast(ray, out hit, distanceToSelect, layerToRaycast)) { string entityID = hit.collider.gameObject.name; if (sceneToEdit.entities.ContainsKey(entityID)) { return(builderInWorldEntityHandler.GetConvertedEntity(sceneToEdit.entities[entityID])); } } return(null); }
public VoxelEntityHit GetCloserUnselectedVoxelEntityOnPointer() { RaycastHit[] hits; UnityEngine.Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); float currentDistance = 9999; VoxelEntityHit voxelEntityHit = null; hits = Physics.RaycastAll(ray, RAYCAST_MAX_DISTANCE, layerToRaycast); foreach (RaycastHit hit in hits) { string entityID = hit.collider.gameObject.name; if (sceneToEdit.entities.ContainsKey(entityID)) { DCLBuilderInWorldEntity entityToCheck = builderInWorldEntityHandler.GetConvertedEntity(sceneToEdit.entities[entityID]); if (entityToCheck == null) { continue; } Camera camera = Camera.main; if (!entityToCheck.IsSelected && entityToCheck.tag == BuilderInWorldSettings.VOXEL_TAG) { if (Vector3.Distance(camera.transform.position, entityToCheck.rootEntity.gameObject.transform.position) < currentDistance) { voxelEntityHit = new VoxelEntityHit(entityToCheck, hit); currentDistance = Vector3.Distance(camera.transform.position, entityToCheck.rootEntity.gameObject.transform.position); } } } } return(voxelEntityHit); }