public void UndoEditionGOLastStep()
    {
        if (undoGO == null || editionGO == null)
            return;

        BIWUtils.CopyGameObjectStatus(undoGO, editionGO, false, false);
    }
    public override void SelectedEntity(BIWEntity selectedEntity)
    {
        base.SelectedEntity(selectedEntity);

        initialRotation = editionGO.transform.rotation;

        SetObjectIfSnapOrNot();

        currentYRotationAdded = 0;
        BIWUtils.CopyGameObjectStatus(editionGO, snapGO, false);
    }
    public BIWEntity DuplicateEntity(BIWEntity entityToDuplicate)
    {
        IDCLEntity entity = SceneUtils.DuplicateEntity(sceneToEdit, entityToDuplicate.rootEntity);

        //Note: If the entity contains the name component or DCLLockedOnEdit, we don't want to copy them
        entity.RemoveSharedComponent(typeof(DCLName), false);
        entity.RemoveSharedComponent(typeof(DCLLockedOnEdit), false);

        BIWUtils.CopyGameObjectStatus(entityToDuplicate.rootEntity.gameObject, entity.gameObject, false, false);
        BIWEntity convertedEntity = SetupEntityToEdit(entity);

        NotifyEntityIsCreated(entity);
        EntityListChanged();
        return(convertedEntity);
    }
    public override void LateUpdate()
    {
        base.LateUpdate();
        if (selectedEntities.Count == 0 || isMultiSelectionActive)
        {
            return;
        }

        if (isSnapActive)
        {
            if (snapObjectAlreadyMoved)
            {
                Vector3 objectPosition = snapGO.transform.position;
                Vector3 eulerRotation  = snapGO.transform.rotation.eulerAngles;

                float currentSnapFactor = snapFactor;

                objectPosition.x = Mathf.RoundToInt(objectPosition.x / currentSnapFactor) * currentSnapFactor;
                objectPosition.y = Mathf.RoundToInt(objectPosition.y / currentSnapFactor) * currentSnapFactor;
                objectPosition.z = Mathf.RoundToInt(objectPosition.z / currentSnapFactor) * currentSnapFactor;
                eulerRotation.y  = snapRotationDegresFactor * Mathf.FloorToInt((eulerRotation.y % snapRotationDegresFactor));

                Quaternion destinationRotation = Quaternion.AngleAxis(currentYRotationAdded, Vector3.up);
                editionGO.transform.rotation = initialRotation * destinationRotation;
                editionGO.transform.position = objectPosition;
            }
            else if (Vector3.Distance(snapGO.transform.position, editionGO.transform.position) >= snapDistanceToActivateMovement)
            {
                BIWUtils.CopyGameObjectStatus(editionGO, snapGO, false);
                snapObjectAlreadyMoved = true;
                SetEditObjectParent();
            }
        }
        else
        {
            Vector3 pointToLookAt = Camera.main.transform.position;
            pointToLookAt.y = editionGO.transform.position.y;
            Quaternion lookOnLook = Quaternion.LookRotation(editionGO.transform.position - pointToLookAt);
            freeMovementGO.transform.rotation = lookOnLook;
        }
    }
예제 #5
0
    public virtual void SelectedEntity(BIWEntity selectedEntity)
    {
        CenterGameObjectToEdit();

        BIWUtils.CopyGameObjectStatus(editionGO, undoGO, false, false);
    }
 private void UndoSelection()
 {
     BIWUtils.CopyGameObjectStatus(undoGO, editionGO, false, false);
     entityHandler.DeselectEntities();
 }