Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Resolved Help with animating a 2D asteroid belt infinitely

Discussion in 'Animation' started by MeliodasX, Apr 21, 2021.

  1. MeliodasX

    MeliodasX

    Joined:
    Jun 11, 2019
    Posts:
    4
    Hi,
    I hope you're all doing fine.
    I am pretty new to Unity as in I have only dabbled superficially into Unity and did some hobby projects on it. Now I am trying to create something serious but I have ran into a little bit of creator's block. I have a sprite of an asteroid belt my colleague made and I want it to give it a feel that it's moving infinitely from background to foreground. Now currently as a make-shift fix I have the belt rotate on the z axis to simulate the feel of moving and after sometime it clamps back to it's original rotation but that looks very jarring. I need a way to make it look seamless. I am pretty stumped and I would like some advice. Any advice would be appreciated.
    Thanks.

    P.S: Attaching a small video showing the current version below
     

    Attached Files:

  2. launzone

    launzone

    Joined:
    Dec 2, 2015
    Posts:
    56
    Why does it jump back? How are you rotating it?
    Another way to achieve an effect like that: instead of rotating or moving the actual object, just change the offset of the asteroid texture on the material during runtime. The texture should wrap seamlessly for this to work though (at least on 1 axis).
     
  3. MeliodasX

    MeliodasX

    Joined:
    Jun 11, 2019
    Posts:
    4
    After a certain time, the rotation of the sprite is set back to its original starting rotation hence the snapback. As for the texture technique, I am already employing that on the infinitely scrolling background but unfortunately, when I apply this sprite as a texture, it becomes a weird glitchy jumbled up mess. Could be something I am missing probably (I have the wrap mode set to repeat).
     
  4. launzone

    launzone

    Joined:
    Dec 2, 2015
    Posts:
    56
    yes if you want to scroll through a texture you probably don't want to use it as a sprite
     
  5. MeliodasX

    MeliodasX

    Joined:
    Jun 11, 2019
    Posts:
    4
    Yes, which takes me back to the asked question. What should I do?
     
  6. launzone

    launzone

    Joined:
    Dec 2, 2015
    Posts:
    56
    use the image as a texture for a material that is on a simple mesh, like a quad and then scroll the texture.
     
    MeliodasX likes this.
  7. MeliodasX

    MeliodasX

    Joined:
    Jun 11, 2019
    Posts:
    4
    OOF, I see what I was doing wrong. Thanks man.
     
unityunity