I am attempting to learn how to create animations in Unity by interpolating between two sets of joint positions of my head model. My first step into this is to simply move the jaw joint down to a given position and back up over time. However, I am completely new to using models and animations in general, so any assistance would be a huge help to me. Linear interpolation is fine. I just don't know how to get something like this set up in Unity.
I have attached the model head I am using.
.fbx file
why don't you try autokey animation? (i'm not shure "autokey" is right term for unity). Something like shown in this video
Depending on the animation, if it's something simple, you can animate via script by changing the positions of the model code and doing so via interpolation.
However, if you want something more complex, you can use the Mecanim Unity which is very good, see: http://video.unity3d.com/video/7362044/.
Or use the tool animation: "Window" -> "Animation". (CTRL + 6)
Remember that to use the Mecanim of unity is necessary to have Unity Pro, but the "animation" does not.
Hope this helps !
Related
I have imported some Maximo animations, but when i use them i see that the character moves with the animation. when i walk for example i want it to be done via code and not the animation. how can i do this?
my animation rig is set to Humanoid, and also to loop when it ends.
i have tried to check if i can find it in the animation window, and if i can see the changes but no result. i think its the animation itself that changes its position. so please help me find this out or help me find another software where i can create an animation without moving the player.
i am talking about walking/running animations i need a way to not move it via the animation but via my character controller script.
Pretty sure you just need to turn off root motion.
https://docs.unity3d.com/ScriptReference/Animator-applyRootMotion.html
Just pick your avatar and uncheck "Apply root motion", or you can change it via code if you prefer.
I am trying to give subtle variation of animation to Unity avatar. Currently, avatar moves exactly to what animation keyframe instructs. Animation I am using is Raw Mocap Data for Mecanim by Unity(https://assetstore.unity.com/packages/3d/animations/raw-mocap-data-for-mecanim-5330).
I also noticed that Unity interpolates between keys in keyframe to offer "Smooth" movement.
However, I would like to programmatically change this smoothing(interpolating) in given time interval.
I tried changing the "Curve" in animation inspector tab but it didn't work.
Also, I tried manually changing the interpolation curve in Animation window curves (curve option between Dopesheet and Curves button). However, it looks like I cannot change them because its Read-only file.
How may I change it?
Eventually, I want to make avatar move with certain variation, just like humans do.
Thank you for sharing your time!
I have an object which has a diffuse shader and on runtime I want the shader to switch to Diffuse Always Visible but this should trigger only if the unit is behind a specific object within the layer named obstacles.
First I tried to switch the object shader with the following code and the shader is changed in the inspector but not in the game during play. I tried placing and calling the shader from the resources and also created seprate materials but its not working.
Here is the code I am using in C#
Unit.renderer.material.shader = Shader.Find("Diffuse - Always visible");
As for the rest I was thinking of using a raycast but not sure how to handle this.
Thanks in advance
I only need the other concept now where the shader changes if a unit is behind an object!
For the trigger, how to handle it will depend a lot on how your camera moves.
To check in a 3D game, raycasts should work. Because whether or not something is "behind" something else depends on the camera's perspective, I would personally try something like this to start:
Use Camera.WorldToScreenPoint to figure out where your object is on the screen.
Use Camera.ScreenPointToRay to convert this into a ray you'll send through the physics engine.
Use Physics.Raycast and check what gets hit. If it doesn't hit the object in question, something is in front of it.
Depending on your goals, you might want to check different points. If you're just checking if something is more than halfway covered by an object, doing a single raycast at its center is probably sufficient. If you want to see if it's at all occluded, you could try something like finding four approximate corners of the object and raycasting against them.
If it's a 2D game or the camera is always at a fixed angle (for example, in a side scroller), the problem is potentially a lot simpler. Add colliders to the objects, and use OnTriggerEnter or OnTriggerEnter2D (along with the corresponding Exit functions). That only works if the tiniest bit of overlap should trigger the effect, and it only works if depth doesn't really matter (e.g. in a 2D game) so your colliders will actually intersect.
I'm using an Oculus Rift with Unity, and am attempting to allow the user to zero-out the orientation of their device when they push a key. The idea is that the camera is frozen looking in a particular direction, and when the user begins the game, whatever direction they're looking in is bound to that camera orientation. I found this forum post, but it only says to use SetOrientationOffset, but doesn't provide code.
I've tried both of the following, independent and together:
OVRDevice.ResetOrientation ();
cameraController.SetOrientationOffset (Quaternion.identity);
However, neither seems to have an effect. I've even tried passing other quaternions into SetOrientationOffset, but that seemed to have no effect.
Does anyone have a working code example?
If different quaternions make no difference then you probably have a game object set in the FollowOrientation variable. If you clear that then passing in different quaternions should have an effect. Alternatively you can rotate the thing you've set in FollowOrientation. Then you need to find the correct orientation to start in. Probably the rotation of the frozen camera is what you need.
This is a bit of a difficult question to search because "mesh" actually means something in Unity, but anyway... I was wondering if there is a way to be able to incorporate the blue 'mesh' overlay effect on top of an object selected in the scene view, except in game. It doesn't look readily available, but I feel like if it's there in the scene view there should be some way to activate it in the game. I want to use it for a 'highlight' or hover-over feature for some objects.
I'm basically referring to what surrounds the capsule in this
http://i.imgur.com/RSwYbRE.png
You want something called a wireframe shader or wireframe renderer. There are some paid versions in the asset store as well as a couple of scripts that should help you achieve this look.
http://forum.unity3d.com/threads/wireframe-shader-the-amazing-wireframe-shader.251143/
http://answers.unity3d.com/questions/144693/wireframe-rendering.html
http://www.starscenesoftware.com/vectrosity.html