Character floating in the air above the plain

I am using Unity version 2022.3.7f1 which seems to be the correct version of Unity for this course. I have already scrapped my game project and restarted once to try and fix this problem, but I am getting the same result.

I have the male dummy characters, with the transform position and rotation set to all zero. The scene is set to Pivot, not Center. The plain is set to position and rotation all zero as well.

unity1_hierarchy
unity2_character_position
unity3_plain_position

In the game window the character is shown floating in the air above the plain, and when I run the game, the character starts by falling down to the ground. Once it has fallen, and I press T the character moves to the target (4, 0, 4) position as expected.

I assume I have done something obviously wrong here, but really cannot see it.

In the Unit script file, and the Update function, at the start of the function I added the line of code:

Debug.Log("character position = " + transform.position);

When I run the game, the initial character position is reported as:

character position = (-0.39, 0.95, -1.33)
UnityEngine.Debug:Log (object)
Unit:Update () (at Assets/Scripts/Unit.cs:11)

after the character has finished falling, it is reported as:

character position = (-0.02, 0.05, -0.07)
UnityEngine.Debug:Log (object)
Unit:Update () (at Assets/Scripts/Unit.cs:11)

so why is the initial character position different to the position set in the Transform? Really quite confused here.

Just discovered the problem, the character is inside the Unit folder, but the Unit folder has its own position! I needed to reset the Unit folder, as well as the character. Worked that out from something in a later chapter.

sigh

Great job working through that!
Within the inspector, the Transform on a child object displays it’s position relative to the parent object.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms