Author Topic: FAQ  (Read 68441 times)

echo17

  • Administrator
  • *****
  • Posts: 1138
    • View Profile
Re: FAQ
« Reply #45 on: June 19, 2014, 05:33:02 AM »
Q: If I have multiple animations going, sometimes the events of one animation affect the others. How do I fix this?

This is a known issue in SmoothMoves if you have the SmoothMoves Control Panel tab open at runtime and only happens while running in the editor. For some reason this editor script interferes with the animation's runtime events. Simply closing the control panel while running in the editor will fix the problem.

echo17

  • Administrator
  • *****
  • Posts: 1138
    • View Profile
Re: FAQ
« Reply #46 on: July 22, 2014, 06:22:32 AM »
Q: How can I quickly change which properties are copied / pasted in the editor?

The array of which properties are selected for copying is stored as an integer in the PlayerPrefs, with each property taking up one bit in the integer. Getting and setting the properties is accomplished using bit masks and shifting.

Check out this script for an example of how to modify the properties that are copied and pasted in the editor:

http://www.echo17.com/support/CopyPasteEditor.cs

To use, place the script in an Editor folder somewhere in your project (Assets/SmoothMoves/Editor/SmoothMoves should be fine). To open the editor window, go to Tools > SmoothMoves > Tools > Copy Paste Editor. You can dock this window in your project for quick and easy access.
« Last Edit: July 22, 2014, 06:27:53 AM by echo17 »

echo17

  • Administrator
  • *****
  • Posts: 1138
    • View Profile
Re: FAQ
« Reply #47 on: July 25, 2014, 06:46:27 AM »
Q: Can I cast shadows with my BoneAnimations?

Yes, but you will need Unity Pro for realtime shadows. Also, you can only use directional lights with forward rendering, but these are Unity limitations.




To set up, you'll need to be sure a few things are correct:

1) Make sure your bone animation is set to cast shadows (and optionally to receive them). By default SmoothMoves unchecks these to improve performance since most games will not be using them



2) Your light(s) needs to have shadow casting turned on



3) Be sure you are using a shader that supports shadows. The default SmoothMoves shader of AlphaBlend will not cast shadows, you'll need something like "Transparent/Cutout/VertexLit" or "Transparent/Cutout/Diffuse"



4) Be sure your shadow distance is set to a large enough value in the quality settings "Edit > Project Settings > Quality". SmoothMoves animations are large by default, unless you scale them down in the import of the BoneAnimationData. Because they are large, your shadow cast needs to be long enough to hit another surface



Here is an example of the chef animation casting and receiving shadows using the above settings. Note that the weapon does not cast shadows because its shader is still set to alpha blend. Only bones in your animation that have a material with an appropriate shader will cast or receive shadows.


Note: the image on the left is distorted due to rotating the scene view. Unity's scene view does not display overlapping textures correctly when rotated. The image on the right is the final game view and is correct.

For more information about shadows, please see the Unity manual here: http://docs.unity3d.com/Manual/Shadows.html
« Last Edit: July 25, 2014, 06:53:03 AM by echo17 »

echo17

  • Administrator
  • *****
  • Posts: 1138
    • View Profile
Re: FAQ
« Reply #48 on: September 16, 2014, 06:07:01 AM »
Q: Why do duplicated animations all change when I change the color on one animation?

When you use "Duplicate" from the Unity menu, you will create a gameobject that shares properties. If you try to update one of the objects, its duplicate will also update. If you don't want this behavior, then you will need to create a new game object from scratch, assign the animation data, then build the mesh.

Note that you can also create a prefab of an animation, then create instances of the prefab. This won't suffer from the same problems that duplication does.

Have a look at this project that shows how you can set the bone color of a single instance of an animation, so long as the animation is not a duplicate:

http://echo17.com/support/BoneColorTest.rar

Controls:
R: change body red
G: change body green
B: change body blue
W: change body white

echo17

  • Administrator
  • *****
  • Posts: 1138
    • View Profile
Re: FAQ
« Reply #49 on: November 14, 2014, 04:49:54 AM »
Q: Is SmoothMoves compatible with Unity 5?

Short Answer: YES

Long Answer:

Starting with version 5 of their product, Unity will no longer be sorting materials in submeshes by their index. This would impact the sorting order of multiple materials, so starting with SmoothMoves version 2.6.0, depth will be handled by z offset. You can still set the depth like normal and the builder will interpret the depth into local z positioning at runtime.

This means that setting the z position manually will no longer be available. This was a compromise that allows the most common feature of multiple materials to still be able to be used at the expense of a more rare feature of manual z positioning. This also means that starting with SmoothMoves v2.6.0 you will need to use an orthographic camera in order to not experience foreshortening of bones due to distance from the camera.

Note that a perspective camera can still be used, but depending on your depth to z position mapping, you may notice distortion effects due to distance from the camera.

You can change the depth to z position mapping in the settings of the SmoothMoves animation editor by clicking on the gear icon:



Two new settings exist to allow you to control how much space is used by the depth to z position mapping:



The Depth 0 offset is the z position that any bone at depth 0 will be set to. Depth Max offset is the z position that any bone at depth 128 will be set to. All the depths in between will be values between the 0 depth offset and the max depth offset. Keeping this range small will allow you to still maintain an illusion of having your animation exist in the same plane, though each bone at different depths will in reality be slightly offset. Having a large range will expand your bones into a large z volume, which can be useful for debugging, but may cause runtime issues if you are trying to get your individual bones to interact with a 3D world.

Note: you will need to rebuild your scene and prefab BoneAnimations to see these changes. You don't need to modify the actual animation data since the changes are all done at build time.

If you are interested in what precipitated this design change, please see these links for more information:

http://forum.unity3d.com/threads/unity-4-2-submesh-draw-order.192467
http://unity3d.com/profiles/unity3d/themes/unity/resources/downloads/beta/unity-5.0-user-guide.pdf (Page 4)
« Last Edit: June 02, 2015, 05:57:52 AM by echo17 »

echo17

  • Administrator
  • *****
  • Posts: 1138
    • View Profile
Re: FAQ
« Reply #50 on: February 18, 2015, 06:50:54 AM »
Q: How can I set the sorting layer or sorting order of a BoneAnimation?

You can create a simple script and attach it to your BoneAnimation. Something like this:

Code: [Select]

using UnityEngine;

[ExecuteInEditMode]
public class SortingLayer : MonoBehaviour {

    private SkinnedMeshRenderer _renderer;

    public string sortingLayerName; // The name of the sorting layer.
    public int sortingOrder; // The order to sort in.


    void Awake()
    {
        _renderer = gameObject.GetComponent<SkinnedMeshRenderer>();
    }

    void Start ()
    {
        // Set the sorting layer and order.
        _renderer.sortingLayerName = sortingLayerName;
        _renderer.sortingOrder = sortingOrder;
    }
}

Note that this works for all kinds of 3D meshes, not just bone animations. If you use it for something other than SmoothMoves or skinned meshes, be sure to change the Renderer caching in the Awake function to the appropriate renderer type.

If you are interested in a fully working example of SmoothMoves integrated into Unity 2D, please see this FAQ:

http://www.echo17.com/forum/index.php?topic=247.msg1096#msg1096
« Last Edit: February 18, 2015, 06:52:42 AM by echo17 »