#:(

1 messages · Page 1 of 1 (latest)

jolly bolt
#
    private float camDistanceXZ = 5f;
    private float camDistanceY = 2.75f;

    Vector3 hoverObjectPosition;
    RaycastHit hit;
    private void Update() {
        var ray = camera.ScreenPointToRay(Input.mousePosition);
        
        if (Physics.Raycast(ray, out hit)) {
            if (hit.rigidbody) {

                if (hit.normal.x == 1f || hit.normal.x == -1f || hit.normal.z == 1f || hit.normal.z == -1f) {
                    hoverObjectPosition.y = Mathf.Round(hoverObjectPosition.y);
                } else if (hit.normal.y == 1f || hit.normal.y == -1f) {
                    hoverObjectPosition.y = Mathf.Round(hoverObjectPosition.y) - 0.5f;
                }

                hoverObjectPosition.x = Mathf.Round(hoverObjectPosition.x);
                hoverObjectPosition.z = Mathf.Round(hoverObjectPosition.z);

                hoverObject.transform.position = hoverObjectPosition;
                
                Vector3 newCamPos = new Vector3(hoverObjectPosition.x + camDistanceXZ, hoverObjectPosition.y + camDistanceY, hoverObjectPosition.z + camDistanceXZ);
                player.transform.position = newCamPos;
            }
        }
    }
#

@iron wren here is my code

#

none of this influences the rotation directly

iron wren
#

indeed, not related to the rotation directly.

jolly bolt
#

you think of anything?

#

i tried setting the rotation manually but it still doesn't reach the goal