My rocket behaves different than expected, when I play the game , even before pressing the “space” button it automatically goes up and land, which is annoying.
Any idea what could be the problem?
My rocket behaves different than expected, when I play the game , even before pressing the “space” button it automatically goes up and land, which is annoying.
Any idea what could be the problem?
Hi Hitesh,
Is the rocket collider inside the collider of the platform? If so, it might be that the physics simulation pushes the rocket out of the platform collider. Try to move the rocket slightly up, so it is above the platform collider, not touching it or overlapping it.
Did this fix the issue or did the behaviour improve?
Still didn’t worked , tried changing platform collider and capsule collider.
Gravity is making it collide even before pressing the space first time.
That’s fine. The rocket will fall down a bit but it should not go up again unless it bounces off the ground.
In the Rigidbody component of the Rocket, try to set the Collision Detection of the player’s Rigidbody2D component to “Continuous”. Maybe that’ll fix it.
There seems to be an error message in your console. Please go to Window > Layouts and select “Default”. If you created your own layout, remove that, select “Default”, rearrange the windows and save it again. That should remove the error message in your first screenshot of your last reply.
Are there more error messages?
Solved error message issue as per your instruction.
Thanks.
But gravity issue still exist.
Could you please fill out our form and send me your zipped project (without the Temp and Library folders)? Don’t forget to add a link to this thread. When you are done, drop me a line here, so I can check our server.
I’m back on Monday.
If you want to work on your project this weekend, please feel free to ask our helpful community of students for advice over on our Discord chat server. I’m sure the solution is simple.
Alternatively, create a new scene with a new platform and rocket to see if the issue also appears in the new scene.
Happy New Year, Hitesh!
I’ve just taken a look at your project with Unity 2022.1.24f1. Unfortunately, I wasn’t able to reproduce your problem but I analysed the situation in the “Over” scene. Maybe one of my suggestions will help you solve your issue.
I disabled the MeshRenderer components on the “Rocket” and the “Launch pad”. Then I noticed that the collider of the latter is much smaller than the mesh. Did you do that on purpose? If not, make the collider as big as the mesh, so the rocket does not move into the mesh.
Here is a screenshot:
Have you already tried to set the Collision Detection of the rocket’s Rigidbody component to “Continuous”?
Sometimes, Unity cannot handle collisions correctly if the game object (with the collider) is scaled. Test the following structure. No scale on the parent with the Collider. Also try to tick “Static” because the “Launch pad” is not supposed to move anyway.
Do the same for the rocket.
Do you happen to use a laptop? If so, make sure to have the power chord plugged in. Otherwise, your operating system might be running the power saving mode, which sometimes causes weird issues in Unity.
If that didn’t help, close Unity and Visual Studio Code. Go to your project folder and delete the Library folder. Then launch Unity again. Wait a few seconds until Unity loaded its empty default scene, then open your own scene and test your game again. Maybe I was not able to recreated your problem because the problem was somewhere in the Library folder.
And if that didn’t help either, install and use the latest version of Unity. That’s Unity 2022.2.1.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.