Description
The PositionWorld
property of the MeshVertex
struct in the Editor.MeshEditor
namespace provides the world-space position of a vertex within a mesh. This property is of type Vector3
, representing a 3D point in space.
It is important to note that this property is marked with the Sandbox.HideAttribute
and System.Text.Json.Serialization.JsonIgnoreAttribute
, indicating that it is hidden from the editor and ignored during JSON serialization.
Usage
Use the PositionWorld
property to access or modify the world-space position of a vertex in a mesh. This can be useful for operations that require knowledge of the vertex's position in the global coordinate system, such as collision detection or rendering calculations.
Since this property is public, it can be accessed directly from an instance of MeshVertex
. However, due to the HideAttribute
, it will not appear in the editor UI, and the JsonIgnoreAttribute
ensures it is not included in JSON serialization processes.
Example
// Example of accessing the PositionWorld property
MeshVertex vertex = new MeshVertex();
Vector3 worldPosition = vertex.PositionWorld;
// Example of setting the PositionWorld property
vertex.PositionWorld = new Vector3(10.0f, 5.0f, 3.0f);