Quantcast
Channel: Questions in topic: "x-y-z"
Viewing all articles
Browse latest Browse all 16

How can I elegantly use the XYZ of a Vector4 to set transform.position of a gameObject?

$
0
0
I use Vector4s data structures to store all my positional data for my gameObjects, using the W component as a metadata placeholder. Can I easily assign transform.position using the XYZ of a Vec4 while discarding the W? Here is how I'd like the code to read: var g_MC : new Vector4[n]; var g_MCgo : new GameObject[n]; g_MCgo[h].transform.position = g_MC[h].Vector3 + Vector3.up; Here is the only way I can currently get the code to work: g_MCgo[h].transform.position = Vector3(g_MC[h].x, g_MC[h].y, g_MC[h].z) + Vector3.up; Any and all elegant help is appreciated.

Viewing all articles
Browse latest Browse all 16

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>