For anyone trying to get it to cycle any direction(though slightly worse on performance because of Mathf.Abs) is to put two children like this, one on the bottom. And instead of checking if it's less than the height, use MathfAbs to check if it's greater than it.(for those who don't know, Mathf.Abs puts the number in the positive if it's negative)
Hey all, Nice quick script! Here's an easy way to math out the position of the image, and what value your IF should be: In your project tab, click on the image you will be using! This will show information about your image. The numbers you need are Height of the Image in Pixels [the very bottom should show ####x####. The first is width, second is height] And you need Pixels Per Unit [by default this is 100] Youll want to do height / pixels per unit. You should set your second image Y Position to this value, And the if(transform.position.y < _____) in the script! Make any seamless image work!!! [Note: you can do this all progmatically too, but art brain likes the visual]
So now I know why mine did not work right. I tried to do it on my own and was messing up because I did not.make the second duplicate a child of the first one. I have a script for each BG and lopped each one. Which worked for a split second then got out of time with each other. But now I see how it can be fixed after this video. Thanks for sharing.
I can took the speed in unity but my background is not moving, whats wrong here? using System.Collections; using System.Collections.Generic; using UnityEngine; public class repeat : MonoBehaviour { public float speed = 4f; private Vector3 StartPosition; void Start() { StartPosition = transform.position; } //update is called once per frame void Update() { transform.Translate(translation: Vector3.down*speed*Time.deltaTime); if (transform.position.y < 0.18f ) { transform.position = StartPosition; } } } THX
If it loops, then you got the code right. if the jump is visible, then its all about minute adjustments in the position of the image. try moving the starting position of the image slightly and see how much jump is visible. if the jump gets more obvious, then adjust the starting position in the opposite direction. good luck
For anyone trying to get it to cycle any direction(though slightly worse on performance because of Mathf.Abs) is to put two children like this, one on the bottom. And instead of checking if it's less than the height, use MathfAbs to check if it's greater than it.(for those who don't know, Mathf.Abs puts the number in the positive if it's negative)
Thank you! This was very helpful, and you explained it so well.
Your "okay" sounds very adamant.
Nice, You make me understand its logic !!
Glad to help :)
Great tutorial. Thanks, man
that was great! thank you so much!
I guess I am kinda randomly asking but do anyone know a good site to watch new movies online ?
This was so awesome - thank you!
Hey all, Nice quick script! Here's an easy way to math out the position of the image, and what value your IF should be: In your project tab, click on the image you will be using! This will show information about your image. The numbers you need are Height of the Image in Pixels [the very bottom should show ####x####. The first is width, second is height] And you need Pixels Per Unit [by default this is 100]
Youll want to do height / pixels per unit. You should set your second image Y Position to this value, And the if(transform.position.y < _____) in the script!
Make any seamless image work!!! [Note: you can do this all progmatically too, but art brain likes the visual]
Thank you so much!!
So now I know why mine did not work right. I tried to do it on my own and was messing up because I did not.make the second duplicate a child of the first one.
I have a script for each BG and lopped each one. Which worked for a split second then got out of time with each other.
But now I see how it can be fixed after this video. Thanks for sharing.
glad this was helpful. cheers!
why my looping is not smooth, any solution?
This is really helpful! Thanks!
Glad it was helpful!
Thanks, you helped me!
thank u very much...very helpful....
Happy to help
I can took the speed in unity but my background is not moving, whats wrong here?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class repeat : MonoBehaviour
{
public float speed = 4f;
private Vector3 StartPosition;
void Start()
{
StartPosition = transform.position;
}
//update is called once per frame
void Update()
{
transform.Translate(translation: Vector3.down*speed*Time.deltaTime);
if (transform.position.y < 0.18f )
{
transform.position = StartPosition;
}
}
}
THX
the only problem is that it doesn't work smooth for me.. It like jumps every time when it returns to the starting point
If it loops, then you got the code right. if the jump is visible, then its all about minute adjustments in the position of the image. try moving the starting position of the image slightly and see how much jump is visible. if the jump gets more obvious, then adjust the starting position in the opposite direction. good luck
try using fixedUpdate instead of update
it worked ! Thank you .
You're welcome!
Can you tell me the program you made the space ship
I did not make it, actually. It was downloaded from craftpix.net/
Thanks man, can you recomend a program which are for free and you can make good sprites?
@@Rohan-lz6ix GIMP is completely free and it is Photoshop equivalent. Take a look - www.gimp.org/ OR Krita is also a good tool.
@@Rohan-lz6ix Was ein Zufall das man sich hier nach 5 Monaten trifft.. xD
@@kaborid_865 mein Freund
Amazing!
Danke hat mir sehr geholfen
Ich bin froh, dass es dir geholfen hat.
can you do it on Visual Scripting, please.
please do more! 🥰🥰🥰🥰🥰🥰
woow..Thank u very much
You are welcome!
ICH WILL EIN KIND VON DIR!!!!!!
ICH AUCH
ACH NE
JA ICH WILL AUCH EIN KIND
Script