The problem is that the objects that make the space station are too many over 1000 objects. So it's hard to go one by one and add a collider to it.
The player have a Rigodbody and I'm using it to detect when entering a door and collide with the door collider and then open the door/s .
I marked with red circle one part of the space station for example that don't have any collider on it. So the player can move through it.
This is the screenshot also of the player inspector settings :
From what I understood from your question is that you don't want the player to pass through the walls. So then when you import an FBX there are import options with a checkbox asking if you want to generate colliders. Just check that off and hit apply.
If you only add colliders to walls you'll still very likely hit into the wall when you stand too close. Read the doc about navmesh, it bakes walkable space and autogenerates margin for non-walkable objects. It's thorough enough.
Also check Youtube channels (there are a lot).
Related
click here for gif show of what I want
I want to remove mesh of object when user click on object and also remove its collider to make another object fall from that removed mesh area...
I am using unity since last month so I don't have much experience and knowledge, please help me...
Creating the destructable ground particles
One way to achieve whats shown in the gif is by creating a prefab of e.g. a circle collider that is instantiated in the area of where the dirt is in your gif. It acts as a "ground particle" and keeps the objects above itself.
You instantiate a lot of them in the area so it acts as a big collider although it is actually a whole array of smaller colliders.
Implementing the interaction logic and deactivating the ground particles
Ater that you implement the functionality of dragging the mouse over the ground particles, removing them. That is also not difficult. Shoot raycasts into the screen at the postition of the mouse (remember to use Camera.ScreenToWorldPoint) and get the collision information (confer to https://docs.unity3d.com/ScriptReference/Collider2D.Raycast.html). With the collision information you can get the reference to the instance of your ground particle(raycasthit.other.gameobject) which is then disabled through script(gameobject.setActive(false)).
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.
For my game, the player character requires to climb up and down ladders those are placed in the gameplay area.
At present, I can able to climb up for my player character to climb down at present I don't have anyway. Because platform box collider applied with platform effector, so for the climb up, effector does not create any problem but now after reaching the top, it becomes solid platform so now I can't able to move downside.
For climbing up, I have followed this tutorial: How To Make 2D Ladders In Unity - Easy Tutorial
I am looking to implement some physics so I can reach downside to the ladder after reaching top.
You need 2 boolean variables isClimbingUp and isClimbingDown which depend on pressed key and a second ray, which will check -Vector2.up direction. Then just add one more 'else if' statement for down direction.
Yes, I have managed to solve this, and the game is published in the stores.
You can check using the below link:
Humpty Trumpty's Border Wall
This is my overall physics setup for the stair:
I have applied a trigger collider to my stair object and disable player gravity scale when the player within the stair.
Then after within the trigger enter and exist, I have done this:
Physics2D.IgnoreCollision(m_CapsuleCollider, myStair.platformCollider, false);
Disable collision between player and platform colliders when the player is within the stair.
I don't think, Platform Effect 2D becomes useful to me in this process but I didn't remove this to remain in the safer side.
So you have to keep a reference of the platform object which is attached to Stair.
I hope you will get a general idea to solve this problem.
my game is a click to move game.In an area, I've got a navmesh walkable and under it there is another walkable part of navmesh.
My problem is that usually after I attack an enemy, sometime but not always, when I click to move my player falls on the navmesh below. I ve got the same problem on the enemies, who simply are programmed to follow the player and attack while in range, who sometime fall.
Nobody has rigidbodies attached.
Any idea of the problem? Feel free to ask ask more details.
Thanks.
Check if your navmesh is set to automatically create off mesh links: open Navigation window, click Object tab, select your terrain/ground object, make sure Generate OffMeshLinks is unchecked. If that fixes the problem, and you want auto generated off mesh links, you can try adjusting the Drop Height and Jump Distance under the Navigation->Bake tab. You can also try toggling Auto Traverse Off Mesh Links on the NavMeshAgent component.
I am trying to hit a ball using a golf club. My golf club has three components (three game objects: handle, shaft and head as shown in the first attached image). Head gameobject's inspector can be seen in the another attached image.
To hit the golf ball, we need a collider. So I put a Capsule Collider at head game object. But I don't see any collider at head gameobject.
The head is shown in the last image.
Why I can't put Capsule Collider at the object?
EDIT:
Thanks for the reply.
I increased the radius but still the same.
I placed a Quad in the scene and put Mesh collider onto it (called AW52Collider). Please see in the
first image. We can see the collider clearly.
But I did the same thing to Club head, as it is also a game object I should be able to put a Mesh collider. But I don't see anything. Why?
Please see in the second image.
One more thing I don't understand is when I put AW52Collider inside Club Head object, I don't see AW52Collider also. Why? Please see in the third image.
Increase the size of your collider, those values do not look like you should see the gizmos at all. Best would be to reset the collider to its default values and then play with them until you are happy.
It is best practice to create a child object with colliders on it. The reason is the placement of the collider. The collider is always centered around the pivot point of a GameObject. But you probably want to move your collider freely or disable a group of colliders manually for testing (or optimization) purposes. Also consider that an object with multiple small colliders as child objects is considered one big collider (rigidbody wise). Source (Compound Colliders)
Just enable Gizmos button and you'll find your capsule collider.
See this picture to know exactly where to find it:
(It's in the toolbar below the Scene tab)