简体   繁体   中英

To get exact position in unity 3d

i declared

public Vector3 floorPosition;

in class. In start function i given

floorPosition = new Vector3(0.000f,0.500f,-8.250f);

i tried to instantiate a gameobject in floorPosition. But object comes in (0.0, 0.5, -8.3) . Automatically it get rounds. What i have to do to get gameobject in exact position.

Thanks in Advance

The weird thing is that if you type

    floorPosition = new Vector3(0.0f,0.5f,-8.250f);
    transform.position = floorPosition;

The inspector will show the exact position you asked for (so I think you object is actually in the right spot) but the Debug.Log() will round it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM