I downloaded a 3D model from the Asset Store. I changed the "Scale Factor" of the model to 0.25
I'm using this model in 2 different scenes and they need to be different sizes, one Scaled:0.25 and the other Scaled:0.40
How can I have the model in the other scene be scaled to 0.40?
Adjusting the scale of the transform of the model in the scene doesn't change the size of the model.
Please help. Thank you!
UPDATE: I'm learning more as I'm trying to figure this out. The original model is composed of Skinned Mesh Renderers (different costumes).
I decided to try something random, I made a 3D object (a sphere) which I could adjust the scale without issue. I then selected the mesh of the model for the MESH FILTER, and then I selected the material for the MESH RENDERER. I now have the model that I could scale without issue. Now the problem is, I made the gameObject a child of an empty gameObject and added an animator component to the parent gameObject, but it doesn't run any animations.
Made it a child of an empty gameObject with an animator component, but doesn't run any animations
Please advise.
Set correct basic scale in imported model:
http://i.stack.imgur.com/i7G1l.jpg
Create 2 objects on the scene.
Set scale of every single object to needed inside of "transform" component
Create prefabs Elf0.4 and Elf0.25 from created objects
delete from scene those objects.
use those prefabs on the needed scenes.
Related
I have a game object with a Character controller. I set it up to move and jump. Everything works fine, but when I add an Animator, the object bounces once after landing on some other object that contains the box collider.
I have already tried many ways, but they did not lead to a positive result. I tried to edit the fbx model, change the anchor point, change the position of the Character controller on the object.
When I removed the animator, the problem disappeared, but I need to use movement animation. And for some reason it affects gravity. Without it, the player's game object jumps higher. I've been working in Unity not so long ago and I don't remember how to solve this problem.
If you are using the RigidBody component, you may need to make a physics material for your player. The physics material defines some properties of the object such as how much it bounces. In the Assets folder: click create > physic material
This will create a physics material. Edit the bounciness and add it to the RigidBody of your character.
I'm new to Unity and it may be a basic information.
I want to animate a FBX model from another FBX model animation.
For example, We have A_FBX and B_FBX files.
*A_FBX has model and without animation.
*B_FBX has model and animation
I have to animate A_FBX model with B_FBX animation with C# program only.
And there should not be any manual steps. Everything through C# code only.
Tried following code, but didn't work. It has some manual work that is we will map the each game object properties with A_FBX and B_FBX.
Animation anim;
//obj1 is GameObject and it will be mapped to A_FBX
anim = obj1.AddComponent<Animation>();
//obj1 is GameObject and it will be mapped to A_FBX
anim = obj2.GetComponent<Animation>();
anim.Play();
Thanks in advance.
I'm prototyping a climbing system for my stealth game. I want to mark some edges so that the player can grab them, but I'm not sure how to approach it. I know I can add separate colliders, but this seems quite tedious. Instead, what I'd like to do is to mark mark the edges in the mesh. Can this be achieved? How?
You're probably better off storing that edge data externally (that is, elsewhere in your running game than in the mesh) in an accessible format, that said, if you truly want to embed it INTO the mesh...
Tuck the metadata into Mesh.colors or Mesh.uv2 like #Draco18s suggests. Most shaders ignore one or both of these. Of course, you'll be duplicating edge/face level info for each vertex on the face.
When a player tries to "grab" an edge, run your collision test, grab the face, grab any vertex on the face, and look up your edge/face info.
You could also, for example, attach your edge metadata collection to a script attached to the mesh's game object. So long as you can access your collection of edges when you need to perform the test, where you store it is an implementation detail.
If you have the ability to add nested objects in your mesh, you could create a primitive box that represents the desired ledge and collider size. When you import the mesh in Unity, the child mesh object will appear as a child gameObject with its own MeshRenderer. You can disable the MeshRenderer for the ledge and add a BoxCollider component to it. The collider will be automatically sized to match the primitive mesh.
Blender Nested Objects example
Unity Nested Objects example
If I instantiate a prefab like so:
GameObject asteroid = GameObject.Instantiate(thing2spawn);
//then set the location and some other stuff
The prefabbed asteroid's collisions do not register at all, but If I simply drag the asteroid into the scene, the collisions work exactly as expected.
Figured it out.
My asteroid object has two child objects which contain colliders that do different things. Hitting a certain part of the asteroid heals you, while hitting the other part damages you. These two children had rigid body components so when I set the speed of the asteroid (the parent object) in code, the two children wouldn't move with it. So it seemed like the colliders weren't working when really they were just left behind in some other place. Removing the rigid bodies from the children fixed the problem.
Weird.
Using Unity 5.0.2f1 for Mac.
Created a UI Text object (called LifeCountUI) in the scene. Then, on my Player's script (attached to my Player GameObject), I have the following field serialized:
[SerializeField]
public Text LifeCountText;
This Player GameObject is also a prefab.
My intention was to drag the LifeCountUI in the inspector to the serialized field on the Player GameObject. However, Unity does not allow me to do this when I select the Player prefab.
It only works, if I drag an instance of the Player prefab on to the scene, and then drag the LifeCountUI to the field (but obviously, that is not the prefab).
Am I doing something wrong here? I essentially want to have the ability to control the text field from the prefab instance.
Have a look at what gurus say about it in famouse 50 Tips for Working with Unity (Best Practices) article:
Link prefabs to prefabs; do not link instances to instances. Links to prefabs are maintained when dropping a prefab into a scene; links to instances are not. Linking to prefabs whenever possible reduces scene setup, and reduce the need to change scenes.
This is one of reason you are unable to maintain a reference.