Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Cube alignment strangeness...

Discussion in 'Getting Started' started by Chusuk, Nov 29, 2022.

  1. Chusuk


    Apr 19, 2021
    Unity 2021.3.0f1

    Trying to position an instanced prefab of a cube exactly above an already placed version of the same prefab.

    When I raycast hit the existing cube I just want to do this:

    Code (CSharp):
    1. newCube.transform.position = hitdata.transform.position + new Vector3 (0,1,0);
    The cube prefab is a game object with a child which is the actual cube. All scales are simply 1 (in parent and child transforms).

    The resulting two cube stack is always slightly off vertical??? (see attached)

    Any ideas?

    I've checked resulting world coordinates and they are exactly the same except Y being exactly 1 greater in the top cube.

    Attached Files: