hey all
ok so i have been toying around with 2D abit… i had this idea for a long time to make some 2D racing game… so i tried rigging something simple up… but its a bit of a problem…
since wheel collider is always facing towards Z axis of the object that is placed on…
so yeh anyone knows how to solve this?, how to rotate pivot points of sprites? it is easy to rotate pivot points of 3D objects… you just do it in modeling software… for example in 3DS max… but how on earth do you rotate pivot points of sprites? :S
no-one tried doing 2D sidescrolling car game with 4.3 yet? … oh cmon…
Dude, I’m trying to make 2d car side scroller too, but there is really no information and tutorials about 2d car physics for Unity 4.3. I decided to use new 2d physics components but I’m stuck with joints. My car acts just like crazy.
As regards your question - you can make dummy objects for your wheelcolliders and rotate them for 90 degrees. Your sprites will be in other game objects, separated from your colliders.
I played around with some of the 2D physics stuff this morning and came up with the following. You can feel free to replace the HingeJoint2D with a SpringJoint2D but you’ll have to play with the settings a bit to get the suspension to be realistic. I think alternatively you could setup some physics materials to be bouncy on the wheels but I have not yet tried it. I hope these screenshots at least help point you in the right direction!
Side note: I don’t recommend mixing 2D physics with 3D physics (as with your WheelCollider) because it can cause some weird results during game play.
thanks to both…
ye i tried doing it with WheelCollider… but that requires 3D rigidbody… and as soon as you have 3D rigidbody, then it just falls through that 2D ground that i have… i guess that 2D ground is just too narrow and does not collide with 3D objects…
so yeh i guess now i have to try with Joints… i never worked with them, so thats why i tried wheel colliders first…
No problemo. The cool thing about hinge joints is that you can use a motor on each of them individually so if you’re building a scrolling car type of game you end up with motors for each of the wheels which is really cool and you are able to control the speed at which they turn.
if only i knew how to use this hinge joint :S not to mention that documentation is just superb for it 
problem seems to be with this 2 settings
Anchor Coordinate in local space where the end point of the joint is attached.
Connected Anchor Coordinate in the other object’s local space where its end of the joint is attached.
i think this anchor is in relation to pivot point of the car right? so in my case that seems to be a bit above windshield?
is there like any proper way of settings values of this anchor… or is it just trial and error like im doing now?
problem also is… that i rotated that collider for 90 degrees
i will try to do it without rotation now, since im not using wheel collider anymore… i’ll report back if i get it working
EDIT:
its working now… the only problem is once car picks up a little bit of speed… wheels start to look all laggy and not really smooth motion…
EDIT 2:
ok problem was that i used interpolate on wheels… looks like that should be off
hinges in unity are really bad… cant really be properly used for anything… since they are SOFT joints not HARD joints…
i mean unity serriously? this problem dates back to 2009 (http://forum.unity3d.com/threads/29961-Why-Do-Physics-Joints-Always-Stretch!)… and you havent done anything about it!!!
i cant really use it in my game… because they add suspension that i just cant control… 
sure i can put mass of the car to 1, and that will eliminate almost all dampening of the wheels, but then that causes lots of other problems… such as car jumping too far etc etc…
edit: i kind of figured it out… under project settings, and physics 2D… if you put velocity iterations to 100 for example… it does physics calculations faster…at a cost of performance… but no matter what, it does it better… so yeh now car aint so jumpy anymore
1 Like