- Home /
How do you make objects solid?
I've been trying for weeks now to figure out how to make terrain trees and objects you import from Google Sketchup solid so that you can't pass through them. I've seen other posts saying you have to use prefabs and colliders,but i don't know how to work those very well. If anyone could help it would be very much appreciated.
I get the impression that very simply you don't know how to "add colliders"
Look in to colliders and learn everything about them.
Try to understand that, models from $$anonymous$$aya etc are just "to look at". Everything about "physics" happens in the game engine and you have to do it ("add colliders") in the game engine.
Answer by by0log1c · Aug 24, 2012 at 11:32 PM
The most common problem beginners face with collision is that they tend to move their objects through the Transform component using Translate() or the position property - these do not trigger Unity's collision detection routine.
To make it work, both objects need a Collider components (Cube, Sphere, Capsule, CharacterController, Wheel, Mesh) AND they should only move using the functions from the CharacterController or a Rigidbody and physics force.
Your question sounds like you're not sure how to use components though, you should probably take a look at the User Manual and the Reference Manual, you might need to get more familiar with the interface and unity's basic concepts.
Answer by lodendsg · Sep 02, 2012 at 04:23 PM
The method I use is as follows
To create a prefab simply right click on the folder in your project view where you would like it to live (dont worry you can move it around later) select Create >> Prefab
This will make an empty Prefab "GameObject" and you can add various componets to it including your mesh, scripts etc. this can be done by dragging and droping or by having the object selected and clicking the "Component" menue at the top of the screen the main ones your looking for are under Physics, choose either CharacterController or Rigidbody
Once you have that added to your object you should be good to go, you may want to adjust some settings such as Use Gravity, Mass, etc. depending on what your trying to get done you will also use theses to manipulate your objects in the game world i.e. in a script assoceated with the object you may call somthing similar to
rigidbody.AddRelativeForce (forwardDirection * thrust * Time.deltaTime, ForceMode.VelocityChange);
There are a battery of tutorieals that demonstrate this in much more detail than I can here
2D tutorial (How to make a game in Unity3D) was useful for me but I am focus on 2D development at the moment.
Answer by godandantess · Nov 27, 2015 at 10:14 AM
I found a simple solution to this answer. I am a beginner and just started the basics, hope we are on the same boat. Select the object you want to make solid and click "Add Component" then go to physics>mesh collider> check convex and add a material and mesh . This should do the trick.
Just a note, where possible it is best to use the primitive colliders: cube, capsule etc. As far as I am aware they are optimised and will run far smoother in general than mesh colliders. And in a similar strand of thought, avoid non-convex mesh colliders if at all possible!!!
Hi GoDand. You don't use mesh colliders in video games. (They are only for a few very specific uses, that are not relevant to this discussion.) It's even easier than you think - you just add ordinary colliders. Box colliders work well. Very few objects in a game need more than one or two colliders - that is to say box colliders. it's just that simple.