English 中文(简体)
Random 2d movement (similar to flies) in Unity3d
原标题:

I want to add random movement to some of my game objects similar to the way flies swarm in Unity3D. I ve developed a method using the addforce() method but would like to bypass the physics engine.

Any help is appriciated

最佳回答

Simple 2D random movement:

var speed = 0.5;

function Update () {
    transform.position = Vector3.Lerp(transform.position,
                     transform.position + Vector3((Random.value-0.5) * speed, 0, 
                     (Random.value-0.5)*speed), Time.time);
}
问题回答

暂无回答




相关问题
Finding the angle of a fleeing dodo

I want my critter AI to run directly away from the player when the player kicks it, and I don t know the math nor the syntax to calculate that angle. They are two characters moving independently ...

Game engines for iPhone vs. native iPhone sdk development

What are people s opinions and/or experiences with game engines such as Unity or Torque Engine? If one were new to iPhone game dev is it worth it to learn one of the engines? What is the performance ...

Random 2d movement (similar to flies) in Unity3d

I want to add random movement to some of my game objects similar to the way flies swarm in Unity3D. I ve developed a method using the addforce() method but would like to bypass the physics engine. ...

热门标签