I am now making a ladder climbing feature and I have a problem about direction. So I try to test InverseTransformDirection function and TransformDirection function with an empty gameObject that has (0,270,0) Rotation(shown in inspector). Here is the code.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class char_control : MonoBehaviour
{
public Transform testobj;
public Vector3 localdir;
public Vector3 worlddir;
public Vector3 localdirResult;
public Vector3 worlddirResult;
void Update()
{
worlddirResult = testobj.TransformDirection(localdir);
localdirResult = testobj.InverseTransformDirection(worlddir);
}
}
And this is the value that the functions return

why the function return weird z value in WorldirResult when I input z =1 in Localdir,I think z value should be 0. this is the inspector of Testobj
That weird number actually means something that could be considered 0, as it is a product of floating point imprecision. That ending with e-n means that number is actually multiplied by 10 to the -nth power, or 0.(n zeroes)1192093 in the case of your number.
See these for a better understanding: