Vector3 targetVector = new Vector3 (0, 0, target) //prepare it Target = (Random.Range(upperLimit, lowerLimit)) //find new random value If (Direction = false) //used to go leftĭirection = true //set to switch to other IF If (Direction = true) //used to go rightĭirection = false //set to switch to other IF Transform.Rotate(0, 0, target) //move there Vector3 currentVector = new Vector3 () //store the current rotation Vector3 targetVector = new Vector3 (0, 0, target) // prepare to move there Target = (Random.Range(upperLimit, lowerLimit)) //create random value Public bool Direction //dictates wether its rotationg left or right Public int lowerLimit = -180 //frequency lower limit Public int upperLimit = 180 //frequency upper limit This is the very begging of the code i tried to produce to start creating something close the the desired results but instead ended up as pile of spaghetti The desired outcome can be seen here in a YouTube tutorial showing this effect created in After Effects. I have no idea how to accomplish this as rotation does not behave the same way as position. I’ve been trying to create a script that will rotate an object on the Z axis a random amount Left and then Right alternately for the duration of run time, and to have the rotation affected by 3 conditions, speed, amplitude, and frequency. I’m pretty new to dealing with rotation in unity and programming in general.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |