I have an object “Fleet” with several children “Squads”, the squads are empty objects that have had a script applied. Once ships have been added, the ‘strongest’ one needs to be shown as the model of the fleet as the fleet moves around the map.
Each ship has a predetermined position (for formations at battle) and so i don’t really want to be moving the leaders ship to the local (0,0,0) for map and move it back again (but i have a feeling my problem would persist even if i did).
And so my idea was that when a leader is chosen, clone it and parent it to the fleet. So now the fleet contains: leaderObject, squad , squad , squad. for example.
When the fleet moves, I am using transform.lookat to point it in the right direction before moving forward. The squads are all fine (checked with testing with no leader object). But when the leader object is added, instead of moving in the positive x direction, the entire object moves in the positive Y direction.
At first i thought it was because the leaderobject’s rotation.x was 270, but after changing that to 0 the problem persists. I can only assume that while transform.lookat is rotating the object itself, it is not rotating it’s children, so that when using controller.move(forwardDirection), the parent seems move in the forward direction of the child leaderobject instead.
Since the last update i’ve noticed a lot of odd behavior like this, is there any documentation any where that explains the new relationship between parents and children?
Thanks for any help.