I am trying to translate the floating origin script I found on the unity Wiki into javascript. I’m working on this section:
if (cameraPosition.magnitude > threshold)
{
Object[] objects = FindObjectsOfType(typeof(Transform));
foreach(Object o in objects)
{
Transform t = (Transform)o;
if (t.parent == null)
{
t.position -= cameraPosition;
}
}
And so far I have:
if (cameraPosition.magnitude > 10){
var index;
var objectsToTransform = GameObject.FindObjectsOfTypeAll;
for (index = 0; index < objectsToTransform.length; ++index){
//var t = (Transform)objectsToTransform[index];
}
But the commented out line is giving me a compiler error. What does (Tranform)o do, and how would I rewrite this for JavaScript?