Adrian Joshua F. Esguerra
Rena Escora
BS-EMC2A
Activity #3: How to make an object move and rotate
1. The 1st thing that you need to do is to add the object that you want to rotate and move on the scene view.
*In my case, I want to rotate the Laser object and Move the Alien Object.
2. Next is add a BoxCollider 2D component on both of the objects.
* In my case I named "Objectmove" for the move script and "Rotate" for the rotate script.
5. Type these codes and click "CTRL S" to save it.
* Objectmove
6. Next is drag those Scripts to the objects that you want to rotate and move.
7. Let's first edit the object that you want to be move. After you drag the Script to the object, Click the object and you will see to the inspector the Script that you just drag on it and you will see the "Pos1", "Pos2", and "Speed".
* In my case, I want it's 1st position to be on the Low.
9. Next is drag the object on the 2nd position that you want it to be and set the speed on how fast you want it to move. press "CTRL S" to save it and after that it should be able to move on it's own once you click the play button.
* In my case, I want it's 2nd position to be on the top and I've set the speed at 1.
10. The last thing to do is to edit the object that you want to rotate. Just click the object and when you look at the inspector you will see the Script that you drag in it and also see the "Rotate Direction" and "Smooth time. Just put "0" on the "X" and "Y" axis and "1" on the "Z" axis. Set the Smooth time on your desired number, Save it and after that, It should be able to rotate once you click the play button.
* In my case, I've set the Smooth time at 1.











Comments
Post a Comment