Quantcast
Channel: Questions in topic: "random spawn"
Viewing all articles
Browse latest Browse all 125

How do I spawn a gameobject at a random positing inside pov?

$
0
0
Hey, I am working on a game where you tap a square and it changes position. But, I have a problem where the square jumps to a random position and instantly jumps back. I also want the square to be inside the pov in a better way than i have now. Can someone please help me? I am writing in JavaScript #pragma strict var Counter : int = 0; function Start () { } function Update () { if(Input.GetKeyDown(KeyCode.Mouse0)) var newPosition : Vector2 = Random.insideUnitCircle * 5; transform.position.x = newPosition.x; transform.position.y = newPosition.y; if(Input.GetKeyDown(KeyCode.Mouse0)) Counter++; Debug.Log ("transforming"); }

Viewing all articles
Browse latest Browse all 125

Trending Articles



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