开发者

Choose empty spot on x and z axis

If I want to spawn objects a开发者_如何学运维round a target, do I have to use the magnitude command like:

Instantiate (enemy, spawnLocation.magnitude, transform.rotation); 

(or something like this)

Or do I have to use something else? Thanks in advance :)


The second parameter to Instantiate is a Vector3 relating to the position. Magnitude should return a float.

The easiest thing to do is to user Random.Range to get a random number. Take that number and add it to the X and/or Z of the target's position.

Let me know if you want some example code and I will see what I can do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜