开发者

Choose empty spot on x and z axis

开发者 https://www.devze.com 2023-02-13 23:02 出处:网络
If I want to spawn objects a开发者_如何学运维round a target, do I have to use the magnitude command like:

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

精彩评论

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

关注公众号