multiple objs already generated by instantiate
Get it with Find and move the position to random.range
I'd like to move each object to Random.Range.
Based on the implementation below, it is not possible to move the retrieved object in Random.Range.
It's done, but it gets stuck in one place.
Is there a way to move multiple objs separately?
float x;
floaty;
float z;
x = Random.Range (-200.0f, 200.0f);
y = Random.Range (-200.0f, 200.0f);
z = Random.Range (-200.0f, 200.0f);
aa = GameObject.FindGameObjectsWithTag("obj");
foreach (GameObject tt in aa)
tt.transform.position = new Vector 3(x,y,z);
The current implementation is
·Set random location information to 200 objects
as shown in
·Set random location information for each of 200 objects
If so, I think it would be good.
float x,y,z;
aa = GameObject.FindGameObjectsWithTag("obj");
foreach(GameObject tt in aa) {
x = Random.Range (-200.0f, 200.0f);
y = Random.Range (-200.0f, 200.0f);
z = Random.Range (-200.0f, 200.0f);
tt.transform.position = new Vector 3(x,y,z);
}
620 Uncaught (inpromise) Error on Electron: An object could not be cloned
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
582 PHP ssh2_scp_send fails to send files as intended
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.