I'm building a 3D car game by using Unity 3D, there are four wheels inside my 3d car model, I created 4 empty gameObjects , put them in the car gameobject and thier position are match with per wheel I added a wheel collider inside each of them but when I ran the game, my car fallig through the terrain. Anyone tell me why?
1:make sure your gameObjects is add collider with another objects
2:check your GOS position in u3d
ps: if you can show the pic on your question , that would be good for your question!!
Related
So I'm making a 2d top down game and one of my enemies is supposed to be a tank. I have two separate sprites for this tank, one for the tracks/body and one and for the turret. I want to have one game object contain both of these sprites. I would just combine them into one sprite but I want to have the turret rotate itself to face the player using a script I wrote while keeping the tracks pointed in the direction the tank is moving. Is this possible? I'm new to Unity but, I cant think of another way to accomplish this goal.
A good way to do this would be have a parent game object A with two children game objects B and C. B can have a sprite for base and C can have a sprite for the top. You can then rotate each game object individually and can still use gameObject.GetComponent(). To move the tank move the parent.
I'm new with unity, this is my first project. I want to make a racing game, as we know unity has that kind of game on it's standard assets package.
Now, my problem is I try to improve that standard packages by combining my own ground design and unity's standard assets car script.
First Position:
I've done with rebuild and combining those elements, then when I play the game then the car's position changes. I don't have any idea about what happens. This is the result :
Can somebody here help find out the solution? Thank you
As per the images you show it seems like the car sinks a little bit in the ground. This can happens because the car has got a rigidbody and when you press play it is affected by the gravity of the scene, so it falls until meeting another collider, in this case the one of the ground (If the ground doesn't fall as well is because it hasn't got a rigidbody or is static).
What you should do is to mark the collider of the ground as static (in case it wasn't static already) and then reshape it, so its size matches with the shape of the ground. The other option is that the car has got a collider just covering to the point of the wheels until it sinks.
Check the shape of both colliders (car and ground) and ensure they cover entirely each game object.
I want to limit the area where my player can walk. In this case only on red segments.
And I want to use 2D sprites as background images not 3D models. But my main player would be in 3D
Can I use NavMesh here? Or should it be done with Tilemap? Or should I place some 3D objects above it?
here is another scene that I would like to understand how to build
You can try adding invisible colliders attached to an empty gameobject to prevent your character from walking into certain areas.
Instead walking on the ground he walk through it same for the ship and debris the other objects. He stay on the ground on the terrain but all the other objects in the scene he walk through it.
In the past i added Mesh Collider to the ship sapceship and checked the Convex turned the Convex on so it worked fine. but now i tried to add Mesh Collider almost to everything in the scene and it didn't change anything.
The scene is not my own but there is nothing speical i think. A terrain camera and objects. I added the ThirdPersonController.
Maybe there is a way to solve it making a new script in c# ? So far i could not find solution.
Make sure the collider of the Player is big enought to hold the model. And also that the terrain collider is adjusted to the terrain.
Try to change Center(Y) value of CapsulCollider
Im making simple 2D game, I designed the "way" the player going through in the game.
If the player touches the wall the game is over, so I must detect collisions.
At first I created the walls from sprites, but then I realized there is no 2D collider that suit himself to the shape of the sprit(it was to difficult to create the collider manually from a lot of smaller polygon and circle colliders), so I made all the walls that builds the "way" 3D objects(.dae files with z=0.001), and added them the mash collider which suits himself to the 3D object. I changed my player to be 3D as well so the collisions types will match.
It worked, but I'm sure the same game can work by much better performance with the same resources if all the game objects were 2D.
How can it be that there if a collider that suits himself to a 3D object but there is none for 2D?
Maybe I miss something?
At my first attempt I didn't export the sprite correctly so the polygon collider didn't recognized the shape of my sprite.
I export the sprite as JPEG, when I export it as .png it worked like a charm, just added the Polygon Collider and it match to my sprite shape perfectly, thanks!