- Home /
I can't make my object grounded and to move it
Hello everyone I'm a beginner in unity, but I'm trying to make my first game. I have my Player, which is a simple pixle art frog which I designed in photoshop and a water lily made in pixel art too. The objective of the game is really simple: just to make the frog jump between water lily. I've watched a lot of tutorials but I can't find any that helps me. My problem is to make the frog grounded in the water lily because once I apply a ridgidbody2d in it it just falls. So my question is What do I have to do so it stays grounded and I can make it move? thank you!
you need attach Boxcollider2D component to your water lily and the frog and in the Boxcollider2D component make sure isTigger box is disable. only add ridgidbody2d to the frog.
Yeah, make sure the Lily also has a collider On it. Else your game wont know if the frog and the lily 'touch' eachother and the frog Will always fall though the Lily. So like tqkiettk says, You need an collider2D :)
The thing is that I did all of that, seen a lot of videos and stuff but still it keeps happenning. $$anonymous$$y frog keeps falling down. As I said to Dream_in_code I've had the idea of denying the gravity scale so my frog didnt happen to fall again. That is what I'm dealing now. Here are two pics of what I have. With the gravity scale in 1 it falls and doesnt stay grounded in the lily. Thanks again!
[1]: /storage/temp/77975-sem-titulo1.png
Okay maybe I Understand your problem. You need a frog stand in water lily so you need rigidbody work on z axis. But ridgidbody2D cannot work on z axis. So to fix your problem you can rotate all Sprite (The frog and the water lily) in X axis to 90.
Set the camera postion to (0, 10, 0), Rotation to (90,0,0).
Another way I think easier is change Physic from 2D to 3D (remove rigidbody2d and add rigidbody component, BoxCollider2D to BoxCollider). Then go to "Edit > Project Settings > Physics" Change Gravity set to (0,0, -9.81).
Hope this help!
EDIT: Add note. Think you missing something when view your screenshot image. 1. you dont add Boxcollider to the Hero (Boxcollider2D or Boxcollider if you using my second way) 2. If you want to see effect when the frog jump. you can set Projection of the Camera from Orthographic to Perspective (optional).
Answer by Dream_in_code · Sep 09, 2016 at 11:23 AM
If you are a beginner telling everything in a comment will be difficult. You can watch this video >> https://www.youtube.com/watch?v=86Bgt--Ww7w&list=PLiyfvmtjWC_Up8XNvM3OSqgbJoMQgHkVz∈dex=2
it has everything you need as a beginner on how to move and jump a player
Thank you very much for that video, I've watched it a lot of times but I have the same problem. In the video, his object was grounded and it didnt fall because of that but in $$anonymous$$e I can't figure out how to keep it grounded and I did everything he did. Here's a pic so you can see it better! I've had the idea to put the gravity scale to zero but when I put that if I jump the frog just keeps going up and he doesnt stop. So I don't really know what to do. Thanks again!
[1]: /storage/temp/77973-sem-titulo1.png
Your answer