Giter Site home page Giter Site logo

unityspritesandbones's Introduction

Unity Sprites And Bones

This is an addon for Unity 3D to create 2D skeletal sprite animations. With the addon its possible to add bone hierarchies directly in the Unity Editor. Sprites can the parented to the bones. The bones can be animated like any other GameObject in the animator window. Inverse Kinematics is also available and animatable. The bones can also be used to animate any GameObject other than sprites like meshes or particle systems.

Features

  • Skeletons and Bones.
  • Mesh deformation
  • Inverse Kinematics with targets.
  • IK Helper objects.
  • IK Angle Constraints.
  • Bones and IK are fully animatable.
  • Bones can be added by holding Ctrl and left clicking.
  • Bone splitting (Subdivision).
  • Flip Skeletons and Bones on X or Y Axis at the push of a button.
  • Mesh creation for Skinnable Meshes using custom mesh creation tools. Meshes are saved as assets.
  • Free Form Deformation using control points.
  • Shaders that support shadows and z-zorting (can be customized per Skeleton).
  • Scaling of root object of Skeleton.
  • Saving and loading of poses. Poses are saved as assets.
  • Helper tools to sort render layers, copy positions and rotations between objects, and create materials for renderers.
  • 2D Ragdoll creation.
  • Fully integrated in the Unity Editor.
  • Undo-Support
  • Lots of gizmos!
  • Did I mention Inverse Kinematics?
  • Free and Opensource

Screenshots:

Forum thread:

Tutorial read the 2DSkeletalAnimation.pdf for an explanation of how to set up and use this tool.

Demo of how to use sprites and bones with this fork:

Installation

After importing into a new project, the Gizmo folder has to be moved to the Asset folder. Otherwise some icons won't show up in the editor and the hierarchy.

unityspritesandbones's People

Contributors

banbury avatar denvil avatar ketura avatar mjholtzem avatar mohrefaat avatar playemgames avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unityspritesandbones's Issues

IK/FK blending

Add an strength value to IK that allows to blend smoothly between IK and FK.

Patch for scaling bones

Bone.cs

    public Vector2 Head
    {
        get
        {
            Vector3 scaleVector = new Vector2(gameObject.transform.up.x * gameObject.transform.lossyScale.x * length,
                                              gameObject.transform.up.y * gameObject.transform.lossyScale.y * length);
            return gameObject.transform.position + scaleVector;
        }
    }

InverseKinematics.cs (resolveSK2D)

    float scale = (b.transform.lossyScale.x + b.transform.lossyScale.y) / 2;
    Vector3 root2tip = (tip.position + tip.up * b.length * scale - root).normalized;

Remove editor code from standalone game

UnityEditor is not availabele in standalone games. All code that uses UnityEditor has to be wrapped into coditional compilation blocks.
IK calculation can't be done in EditorUpdate() in a standalone game.

Avatar editor

Add a dialog, that allows to create a skeleton with sprites quickly.

Workflow:
Select a skeleton prefab. The dialog shows a list of the bones in the skeleton. Assign a sprite for each bone. Click create button. A skeleton with sprites is spawned.

Optional: Preview of the avatar.

Errors when building for WP8

Something in the SkinMaker.cs script is not supported by WP8 and causes WP8 builds to fail. Should be easy to fix with a platform selector since this code is only necessary in the editor.

Export Animation frames to PNG sequence enhancement

Export animations built in Unity Sprites and Bones to a PNG sequence so that they can be used outside of Unity or for sprite animation.

I think it can probably be done with this:
http://docs.unity3d.com/Documentation/ScriptReference/Application.CaptureScreenshot.html

or this:
https://docs.unity3d.com/Documentation/ScriptReference/Texture2D.EncodeToPNG.html

I'm sure it will need ARGB32 to handle the transparency though.

Basically have a camera created for taking screenshots, have a script attached to the camera that takes them at the resolution of the camera, and outputs them at a variable of frames per second you want to export for the PNG sequence. Play the animation and have it spit out the PNGs to files for the FPS specified.

It might be possible using something like this, but may need Unity Profor the render texture:
http://answers.unity3d.com/questions/12070/capture-rendered-scene-to-png-with-background-tran.html

This is also helpful:
http://forum.unity3d.com/threads/45193-Render-Particles-to-Animated-Texture

Mirroring Sprites

Create an easy way to mirror bones and attached sprites.

Optionally: Mirror animations, too.

Animation baking

Bake IK animations into new animations, where keyframes are created for every bone.

There should be options to bake for every frame or every existing keyframe.

Weight painting

Create a tool for assigning vertices to bones and change the vertex weight.

Having issues with Rotation

I wanted to make an animation using the bones and sprites and however I've had it successfully work with an arm. When doing it with a leg, using similar skeleton/bone structure it gave me quite a few problems. As seen here. If you need my project folder to further examine, it's like the rotation values are possessed in which case they manipulate and change all on their own. I have only touched the Z rotation but as seen here the Y rotation acts behaviorally weird. Causing the entire animation to collapse.
http://i.imgur.com/aPTO3W9.gif

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.