Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bezier Circle Actions from Blender to Unity

Discussion in 'General Discussion' started by awplays49, May 16, 2015.

  1. awplays49

    awplays49

    Joined:
    Nov 9, 2014
    Posts:
    36
    How is this possible? I want to know how I can move a curve modified object in an action and export that action.

    I have a tank track and there's hundreds of people who have done what I am trying to do successfully. But how? I baked the animation and it didn't work. I tried rigging, but that had it's own problems... I need to use an unapplied curve modifier, its the easiest way. No tutorials show how to export as an FBX.

    Does anyone know?

    EDIT

    I also would like to mention the steps to reproduce.

    1 Open Blender.

    2 Make a bezier circle and, in edit mode, scale the left and right points out a lot, and the top and bottom out a little to make an oval.

    3 Add in a cube and edit it into a tread link, of desired shape. This will be duplicated later to make a track.

    4 Add an array modifier, change the relative offset to desired spacing on desired axis, and bump up the duplication count. Leave this unapplied.

    5 Add a curve modifier, and select the bezier circle for the target. Wrap it around the selected axis. Leave this unapplied.

    6 Fine tune the wrapping of the tank track by scaling it, grabbing it and changing the array's relative offset and duplication count.

    7 Add an empty cube by doing [Shift >>> A >>> Empty >>> Cube].

    8 Move the empty cube to the middle of the tread.

    9 Snap the cursor to the bezier circle's center by using object mode, then set the track's origin to the cursor by doing [Object >>> Transform >>> Origin to 3D Cursor].

    10 Add an action to the cube and change the frame range to 1-64.

    11 Add a location keyframe to the cube at frame 1.

    12 Select keyframe 64, move the cube 16 units away from the track, so the track rolls about 360 degrees, and take another location keyframe of the cube.

    13 Export as fbx with "Apply Transform" checked, orientated as [Forward: Z, Up: Y].

    Hope I get some useful information based on what I've given here. Thanks!
     
    Last edited: May 16, 2015
  2. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    That seems to be what the track system does in the MegaFiers asset as seen in the video below but with more control. If each of your objects is animated then baking the animation during export should bring it into Unity just fine but you will be limited to the single animation, using a system such as the one in the video will give you complete control over the speed and direction of the playback which would be a lot more useful.
     
    zombiegorilla likes this.
  3. 3agle

    3agle

    Joined:
    Jul 9, 2012
    Posts:
    508
    To add to the above comment on MegaFiers, you can export out a .spl (or .svg) file of your spline data and use that within the MegaFiers components.

    (note we've been using 3DS Max, but I'd imagine Blender can do the same, quick google gave this: http://blender.stackexchange.com/questions/6675/can-blender-export-2d-curves-to-svg)
    EDIT: Ok, might be out of luck with Blender, I've been informed that Megafiers uses a specific plugin for Max to do the export which we got from their support team. I guess it's worth contacting them and asking.

    We've been using that for some path-following type behaviours.
    We haven't figured out a way to do that within the FBX itself yet, that's not to say it's not possible though (I'm not sure if it is or isn't).
     
  4. Fera_KM

    Fera_KM

    Joined:
    Nov 7, 2013
    Posts:
    307
    You are talking about adding using a bezier as a motion path right?
    This is not just a Unity related problem, but a general one, since the world space coordinates of the object doesn't change.
    A few years back, I solved it by making a script (maxscript) that realigned another object to the cube attached to the motion path, made a keyframe for object number 2 and skipped to next frame, and repeated these action.

    Though, I am sure there is already someone that has made a good baking script for this already.
     
  5. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,042
    There are are few approaches. You can animate textures as in this asset:
    https://www.assetstore.unity3d.com/en/#!/content/13351

    There are also some assets that give you full control like this:
    https://www.assetstore.unity3d.com/en/#!/content/13351

    It kind of depends on your needs. Physics can be expensive, scripting is nice middle solution, and of course animating textures is the least expensive.

    About a year ago, I was working on an idea for a robot puzzle type game that that had tracked robots. I did a bunch of exploration, and found that there were basically a ton of way to approach it. My initial tries were just using Unity physics components, (rigidbodies, fixed/hinged joints) these were the last results before I took a different approach (I went with a different style and animated textures):

    This one uses a very simple script to apply torque to the large wheels:


    And this one has no controls, just the motor on the hinged joints:


    I like the way they turned out, but both were very expensive, and things could wrong pretty quickly since they were relying entirely on physics.
     
  6. awplays49

    awplays49

    Joined:
    Nov 9, 2014
    Posts:
    36
    Thank you for all your helpful replies! :)

    Unfortunately I still haven't seemed to find an answer that suits my needs...