0

I'm making an Android game inspired in Flappy Bird, so I followed the Unity's Official tutorial (using custom sprites and script for my bird for better feeling);

But as you know Flappy Bird must be smooth, and I can't make mine feel like the original, the scrolling objects seem to ghost a bit, they move constantly but I can notice especially on Android that they seem to move with low fps, but the bird which only moves up and down moves smoothly, I'm using Velocity for the bird, but he is Dynamic, not Kinematic -> rb2d.velocity = new Vector2(0, FlapForce);

The problem is I can't figure it out how to move the Kinematic Obstacles(green pipes) and Scenery objects(theGroundForExample) to make the illusion of the Bird moving. I've tried these

transform.Translate(Vector2.left * 17f * Time.deltaTime); - not smooth
rb2d.velocity = new Vector2(17f, 0); - not smooth
rb2d.velocity = rb2d.velocity.normalized * 17f; - doesn't do anything

I also tried making them dynamic with gravity on 0 and use addForce, but they don't move I tried to put this codes in Start, Update and FixedUpdate but it's always the same I tried Interpolate and Extrapolate, but still, I don't see any difference.

I've read numerous of other questions related, and I tried many things but anything works, I read a lot of unity documentation, and I also read this: Timesteps and Achieving Smooth Motion in Unity But I didn't understand how to implement that and how it works.

Thank you in advance to everyone who read this, all help is truly appreciated since I'm stuck with this for days, and I don't want to continue with the game before fixing this because it is essential, thank you!

Edit1: Here is the video of what I mean, I hope you can see because I had to record with my phone due to my PC being too bad to record properly. https://drive.google.com/file/d/1GqCf2u_sBxv9yDxiDvZ-8MS1FRWVcdRd/view?usp=drivesdk

Edit2: There is a apk file(the only purpose is to you see the pipes are not moving smoothly, the best way you can see is there) https://drive.google.com/file/d/1zXdhz1ZexjRw3NbMrUxAh7_ShMXpj9jo/view?usp=drivesdk

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
ColdFire
  • 1
  • 5
  • I made a similar thing as a tutorial and what I did was vertical force force to the bird with the AddForce function. I never moved the bird in the vertical dir. The secret is to move the background instead. You can still do it your way but it would be more complicated to do smoothly but still possible – Programmer Oct 31 '18 at 19:01
  • Yes i'm moving the background, the bird only moves in the Y axis – ColdFire Oct 31 '18 at 19:24
  • By the way @Programmer sorry for the late reply, i was checking if someone answer me in unity's oficcial page but nobody ever does ^^' and meanwhile was still trying to fix the game and didn't see the time pass. I don't wanna give up on this, i really don't. Everytime i go to sleep i keep thinking and thinking and i can't figure this out, i'm kinda desperated so i had to ask for help, thank you very much – ColdFire Oct 31 '18 at 19:29
  • 1
    I missed the *"and Scenary objects(theGroundForExample) to make the illusion of the Bird moving"* part. You missed a part of my comment. You should add force to the bird with AddForce instead of changing the velocity. Also, replace the `17f` with a public variable you can edit from the Editor. Make that value to be a smaller one. – Programmer Oct 31 '18 at 20:10
  • I tried addForce but i think the velocity feels better, the problem isn't in the bird but thanks. The speed is 17f because my camera size is 35. If that is a problem i will update the game ti fit a lower camera size. Do you have any ideias to move the Pipes smoothly? – ColdFire Oct 31 '18 at 20:23
  • *" the problem isn't in the bird"* You didn't mention the problem....What's the problem if not the bird? I assumed the problem is the bed not jumping smoothly... – Programmer Oct 31 '18 at 21:04
  • It's for the pipes and the background, right? Get rid of anything that's already moving the pipes and put this in `void FixedUpdate()`: `transform.Translate(Vector2.left * 1f * Time.deltaTime);` Is there anything going wrong when you do that? – Ruzihm Oct 31 '18 at 21:30
  • @Programmer Sorry if i didn't write things good enough. The problem are the pipes because they are moving in the left direction, but they don't move smoothly – ColdFire Oct 31 '18 at 21:49
  • @Ruzihm When i do that it still is not smooth, it's nothing like the original game Flappy Bird, i can see like a ghosting in the pipes, like if i had low fps or something like that, if you need i can try to show you a video, thanks for the help – ColdFire Oct 31 '18 at 21:51
  • @ColdFire Yes, please post a gif or video of what's going on, and include it in an edit to your question. – Ruzihm Oct 31 '18 at 21:58
  • In the meantime, go into your texture and turn off compression, mipmaps. Then, in your spriterenderer's material, turn on pixel-perfect mode. – Ruzihm Oct 31 '18 at 22:06
  • Did you attach Rigidbody to them (pipes)? – Programmer Oct 31 '18 at 22:17
  • I havent the mipmap setting and the pixel-perfect either, i'll try to record a video with a program, altough i never tested with unity, so i hope my pc can handle it – ColdFire Oct 31 '18 at 22:18
  • @Programmer Yes i did and i made it Kinematic – ColdFire Oct 31 '18 at 22:23
  • It's RB powered so use the MovePostion function. Your Move Dir is `Vector2 velocity = new Vector2(17f, 0)` then move it like `rb2d.MovePosition(rb2d.position + velocity * Time.fixedDeltaTime);`. It must be done in the `FixedUpdate()` function not `Update` function – Programmer Oct 31 '18 at 22:27
  • @Programmer Okay i will try let me upload the video first – ColdFire Oct 31 '18 at 22:35
  • Since it is impossible for me to record a video in my pc, because it is too slow for that(PentiumIV 2.0ghz you know..) So i will record with my phone – ColdFire Oct 31 '18 at 22:40
  • @Programmer i tried your code but it doesn't work, the game glitches hard, i will read better how MovePosition works – ColdFire Oct 31 '18 at 22:58

0 Answers0