Updated position Unity3d -


I have a tablet that has to kill the enemy continuously.

So, in the bullet script, I have announced the change

  changing the public enemy;  

Now, when I try to use enemy.position in the bullet script, then hit it in the bullet script, enemy.position shows the situation on which the enemies were flying and not at the location on which the bulletproof was shot.

How can I get an update of the enemy every time the object is Bulletproof Institute.

In this way I am changing enemy status:

  Zero update () {float amttomove = currentSpeed ​​* Time.deltaTime; Conversion Translate (vector 3. left * amitomov); If (transform.position.x & lt; 0f) setposandspeed (); } Zero set popespeed () {x = 11.5f; Z = 0.0f; CurrentSpeed ​​= Random.Range (Min Speed, MaxSpeed); Y = Random Range (0f, 2.5f); Transform.position = new vector 3 (x, y, z); }  

This is where the bulletscript tried to use the enemy's position:

  float target_Distance = Vector3.Distance (Projectile.position, Target.transform.position);  

It is said inside the start of the bullet script ()

This is where I have inserted the tablet into the Player Class:

Within the updated method:

  if (Input GateCadown ("Space")) {Vector 3 position = New vector 3 (Transformation.x.x, Transform.ap + Collider. Boundskies. I / 2); Institiet (Bulletprofab, Position, Quaternion Idea); }  

Enemy. The betting comes to the place at which the enemies were flying and not at the place where the bulletproofab was shot.

No, enemy.position will return the current status to the enemy, if you want your projectile to follow the enemy.

If you dynamically give your projectiles ( BullerScript ) immediately and want to shoot them towards the enemy's position shoot frames, for example, the bullet will start immediately Record it after:

  class bullet script: monobehavior {public Vector3 targetPos; Zero Update () {// Go to Goal}} Bullet Script Bullet = Game Object Instantiet (bulletprabeb, shootpoint) bullet script; Bullet.targetPos = Enemy status;  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

How to access user directory in lazarus? -

java - Gradle dependencies: compile project by relative path -