i have a missile which is a child object of a missile truck.
the missile is firing perfectly and goes at the player
it has a rigidbody2d (which i think is what the problem is, but it needs it)
i want the missile to move with the truck (in its position on the back)
then launch at a random time.
Though you forgot to state what the problem you’re experiencing actually is, I can guess that to fix whatever you’re experiencing you probably need to do one or both of the following:
you need to un-parent the missile when you fire it
you need to disable the rigidbody (rather, turn off simulation of the rigidbody) before you fire it.
Epoch! Hows your zoomy-zoom blasty-blast dawgfight coming along? Always a good sign to see you are reaching for some enemy trucks.
I agree with Madgvox above. The missile would be a correctly offset child of the truck so wherever the truck goes, the missile just comes along. The missile would have the rb turned off, then turn on simulation and launch the missile when needed.
ANOTHER way is to make the truck with missile as a visible parented pair of non-physics visula objects, no Rigidbody: when the truck fires, hide the missile and spawn the actual rigidbody-equipped missile at the right point and off it goes (all the same moment). When the truck reloads, have it just turn on the missile sitting in the back of it.
Here is how I would parent it in both cases, to keep for maximum flexibility in terms of art and stuff:
Ha kurt having a blast! I have a soldier that dies differently whether you shoot him or blow him up and my rockets are working well just have to get them moving with the truck and then launching. After that an AA flak cannon!