currently I am working on 2d game using unity (based on some tutorials available). one of the game object moving staright downwards as shown in the image (attached) below. I want some random movement as mentioned in the image. can anyone update me with some references or resources so that I can manage to acheive this kind of movement ? Thanks in advance.
I did something similar. First of all you need to move all obstacles into local coordinates of the ship you currently want to process. Transform.InverseTransformPoint does this. Then you can divide all local space into 3 parts: left, right and forward. If obstacle has x < 0 (in local coordinates of current ship) then it is surely in left part. if ship has z / x > 1 then it is in forward quarter of space. According to this data you can define if you need to move left or right(if there is no obstacle there) to pass some ship in forward.
ufo_driver… thanks for your reply. But I am not getting this point “First of all you need to move all obstacles into local coordinates of the ship you currently want to process. Transform.InverseTransformPoint does this.”…