Hello,
I’ve begun using unity not long ago, and I’ve been able so far to get my problems fixed by browsing around the forum/web so far. However, there is this… basic problem I can’t seen to figure out.
The behavior I want is like… seeker missiles. So I have a NPC, and it is constantly firing towards the player. Ok, great. However, just the first “missile” follows the player. When this missile hits the player, the next one begins following the player, and so on. What I want to do is that ALL follow the player, obviously =P, doesnt matter if the first is gone or not. This is certainly a problem with referencing the Missile gameobject, here’s what I’ve tried out:
(its javascript)
I’ve got a static function that is called every frame, and it accepts the following parameters:
The object calling the function as a GameObject.
The speed it should be able to turn (rotate) as float.
The speed it should move towards the target as int.
The target as GameObject.
A boolean to inform if it should actively follow the target, or just point towards it.
This function then makes the calculations and moves the “calling object” on the right direction.
On the NPC, I get the “gun” tagged game object, and call the Firemissile function. This function instantiate a prefab, Missile, and sends the values for rotation, follow speed and the target, in this case, gameobject tagged as “player”. Then, on the Missile prefab, on the Start() I set that “user = GameObject.FindWithTag(“Missel”);” and call the static function with the parameters. I’ve tried before “user = GameObject.Find(this.name);” also but had the same result. How exacly do I call the script’s parent gameobject from code, or am I doing something wrong before that?
Also, I’ve got another question, related to textures this time. I have a pretty big object in Unity that the player will be able to walk on. I’ve created a baked texture on Max, but when I apply it in Unity, the quality is really low, doesnt matter if I bake a 1024x1024 or 4000x4000 texture, I get the same result. Is there a way to fix this?
Thanks for your attention,
Allan