Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by SouthernZax · Oct 27, 2014 at 05:22 PM · 2dcharacterwalking

My character is really jumpy/laggy

http://gyazo.com/e145a21952eb31d2f21e26a68e27ac69 Here is a low frame rate albeit fairly depictive gif, it's much more jumpy running live and if necessary I can upload to my server so you can play it and see what I mean, I am just using this game to learn but this really jumpiness is an annoyance that I can't solve..

Anyone have any idea? My movement is pretty much the script from the 2D example, its walking on top of a box collider of course, and has its own box collider and a ground check.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Dendrake · Oct 27, 2014 at 06:03 PM 0
Share

Are you using a circle collider for the character's feet? $$anonymous$$ight help

avatar image SouthernZax · Oct 27, 2014 at 06:18 PM 0
Share

I am using a square collider and a jump check empty game object, thats all.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Madcowe · Oct 27, 2014 at 06:43 PM

First of all test if this works:

Go into the project settings (or the actual code) and remove the gravity, also make your character be above the ground and try moving. If he moves smoothly it means that the collision is getting "stuck" on the ground.

That is why many people add a "skin" variable to their collision detection scripts, usually something like 0.01f so there's that small gap between the player and the ground.

That is my guess on why it's like that

Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SouthernZax · Oct 27, 2014 at 07:48 PM 0
Share

I disabled its rigidbody gravity, you can see it here http://gyazo.com/b7d89c38d2be3c2bc77388f6e3773522 it's still jumpy as usual, also I made sure you can see my rigidbody setup at the beginning of the gif, you will notice a collider in front of him, thats to stop him from getting stuck on the edge of platforms and stuff, it works pretty well, and I tried it with that disabled and same thing, so I doubt thats what's causing it.

  • Updateish, here's the inspector pane http://i.imgur.com/tZp2ThJ.png and if you see where it says Interpolate on the Rigidbody 2d, I turned that to none and when in no gravity it is very smooth now, look: http://gyazo.com/e15d4f1098818a71ff6cf0d108f42f0b

However.. turning gravity on to 0.65: http://gyazo.com/78bbecd35871f609c2ab47acbb1dc205 it gets JU$$anonymous$$PIER! (It's like 10X worse looking in real time lol, he literally becomes fairly blurry)

So.. I should I move my main collider down? or put one underneath him from his main collider and bump collider?

Is it possible he's running into the collider thats a few pixels in front of his main collider? http://i.imgur.com/qDN$$anonymous$$2H1.png

avatar image Madcowe · Oct 27, 2014 at 07:59 PM 0
Share

Hm that is very strange... my only guess at this point could be the angular drag? I don't know but it's strange... is your PC powerful? Or at least decent? As in, it's not a 10 year old machine right?

avatar image SouthernZax · Oct 27, 2014 at 08:09 PM 0
Share

Thanks for all the help so far by the way, it means a lot, this is literally my first solo project outside of the tutorial projects so I am learning heavily here, thanks for the patience :)

To answer your question, my PC is plenty plenty fast enough, I have yet to meet a game I can't max out, so I would find it sooo awesomely funny if I couldn't run my own tiny 2d platform learning game lmao.

I turned the angular drag down and it still occured, I thought maybe if you saw the script it might help? I do warn once again that this is my first solo project so my coding is pretty horrible and I am using part of the 2D example code, and some of that extra code is wall jumping btw.

http://pastebin.com/fCEDuBjS

avatar image Madcowe · Oct 27, 2014 at 08:12 PM 0
Share

hm maybe it isn't the collisions, can I see your movement code or something like that?

avatar image SouthernZax · Oct 27, 2014 at 11:23 PM 0
Share

I linked it above I believe: http://pastebin.com/fCEDuBjS

Show more comments
avatar image
0

Answer by Marzoa · Oct 27, 2014 at 11:08 PM

If you have may animators, or animators that involves many objects, you may try setting "Culling Mode" of such animators to "Based on Renderers" instead of "Always". Just for trying anything else...

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SouthernZax · Oct 27, 2014 at 11:25 PM 0
Share

I don't have any animations yet, everything is very static because I am still in fairly early development.

It's really weird too because I don't remember this being an issue a few days ago now it is, I just don't know what might be happening..

avatar image Marzoa · Oct 27, 2014 at 11:34 PM 0
Share

In such case I would try disabling all objects' renderers in the scene and reenabling them one by one to see if I can isolate the problem in one object or just a group of them.

You may check also the quality settings, maybe unwittingly you changed them or something.

avatar image Madcowe · Oct 28, 2014 at 09:21 AM 0
Share

Hm I think the problem might be this piece. if(h rigidbody2D.velocity.x < maxSpeed) // ... add a force to the player. rigidbody2D.AddForce(Vector2.right h * moveForce);

Try using <= maxSpeed ins$$anonymous$$d and see if it helps

avatar image SouthernZax · Oct 28, 2014 at 01:33 PM 0
Share

Oh my god.. I am a complete freaking moron.. I just solved what was going wrong, I went and started a new project and started importing the assets and stuff slowly into there testing it to see what was breaking and I noticed the movement was just fine on a collider elsewhere, so I added the camera in to track the player because I wanted to slowly add every other little bit in..

and it hit me.. It's the damn camera movement script.. As soon as I disabled the camera follow player script, the player rolled like butter..

This is the camera movement script: http://pastebin.com/7E2Ef$$anonymous$$Z4 any idea how I might improve that?

also thank you very much for your help, apologies for it being something so stupid lol, this has haunted me for the past near week, I am really glad that I finally posted xD

avatar image Madcowe · Oct 28, 2014 at 02:28 PM 0
Share

If you make the camera a child of your player it will always follow (Drag the camera on top of the player)

But if you want to use code why not just something like camera.x = player.x and so on? :P

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Flat 2d image on 3d character. 0 Answers

when 2d character hits wall it shakes/bounces 1 Answer

Background & sprites are smearing towards the player during movement. Help determine the cause and solution? 0 Answers

how to add a walking animation when character is moving? 3 Answers

Ui sidescroller 2d touch ? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges