I’m just starting to learn unity2d and I’m trying to create rotating obstacles that expand and contract.The obstacles are supposed to be in the pattern of a circle,which needs to keep rotating.
I first created multiple objects and then added the following code to each,with each object having a different angle.
Here is the code I’ve got for rotation and the expansion.But there is something wrong with it that makes the looping go wrong.
You probably want to use different speed values when computing your angle, and radius changes.
I’m not sure what the if(radius<0) is supposed to detect- don’t you always want to have a (radius >0)? If this is to check the minimal size of the circle, I don’t see where you check for the maximum size of the circle radius?
May I suggest, that instead of if-statements, you use another SIN function to add/subtract a cycling amount from your radius.