playMaker

Author Topic: Animation vs. Playmaker: Fight!  (Read 4939 times)

Sobriquet

  • Playmaker Newbie
  • *
  • Posts: 3
Animation vs. Playmaker: Fight!
« on: June 23, 2011, 07:03:44 PM »
Hello!

I am fresh off the playMaker farm and am trying to create some FSMs for my game.  Problem is, adding states causes horrible (if funny) mishaps with my models.  I have had models lay down sideways, disappear, move from 1 set of coordinates to another (without directions to do so,) and my personal favorite, when I use iTween move to, all of my models insist on walking towards the camera butt first.  My camera jumps from model to model a lot, it is not a straightforward FPS.   

Could anyone give me some advice on how to use playMaker without borking my models?

Thanks!

Xtopher

  • 1.2 Beta
  • Junior Playmaker
  • *
  • Posts: 71
    • Well Played Games
Re: Animation vs. Playmaker: Fight!
« Reply #1 on: June 23, 2011, 08:26:46 PM »
The first thing that comes to mind is that maybe your models are not lined up with the transforms the way you think they are.  Check them for their local orientation and see if it matches what Playmaker expects.  Unity is a "left hand forward" orientation, meaning that if you hold your left hand up in front of you and point your index finger out towards your front, your second finger 90 degrees to the right, and your thumb straight up in the air, you have the X,Y,Z of Unity space.  Z is "forward", X is right, Y is up. 

This all means if you tell an object to move "forward", it's going to travel along the Z axis in a positive direction.  It will not move according to the way it "looks" like it should travel!  If you have a character that was saved in a 3D program with the positive Z axis facing out it's back, then unity will turn that character around to move it "forward", even though the model is facing backwards.  Likewise, if you have a model where the Y axis is up, upon using it in Unity it could flip onto it's back or side.

The solution to this is simple... in your 3D program, align everything to match the Unity coordinate system.  Rotate your models so they face forward down the Z axis, and make sure that Y is up in your programs settings.  When the model is placed appropriately, simply save it and re-import into Unity.

It's also best to place your models at the world center (0, 0, 0) and then freeze transformations on them.  Unity will use that 0,0,0 point of the model to determine where is is in the scene and move it from there.  Your model will rotate and transform around that point, not it's visual center.  You can use this to your advantage, like raising the character up so the 0,0,0 point sits between it's feet, or otherwise offsetting complimentary models so they snap perfectly together when they are both placed at the same numerical location (like a treasure chest and it's lid, or a building foundation with four various house tops)

Hopefully that gets some of your problems sorted out.  If not, maybe share more specifics?

Sobriquet

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Animation vs. Playmaker: Fight!
« Reply #2 on: June 23, 2011, 10:49:05 PM »
Thank you for that, that might just be what is going on!  I will have to do some tweaks and figure it out.

However, it might not be what is going on.  One specific I can detail is that I had a model (we'll call him Bob) that was standing right side up and facing correctly.  I put a script on him that would turn his renderer off and on in a specific amount of time.  When I was looking at the scene, he was standing up properly; when I hit "play," he was lying on his side on the ground.  The only change I had made was adding the script, which didn't affect where he was standing or his transform in the slightest.

Sobriquet

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Animation vs. Playmaker: Fight!
« Reply #3 on: June 23, 2011, 11:06:08 PM »
Okay, I did go back through and check, and oddly enough, I was going positive on the Z axis (purely by chance) and the model still turns around 180 degrees.  While the animation plays walking forward, the model is coming towards the camera bass-ackwards.  There is no reason for it to turn 180.  I actually went onto the Transform and spun the character around 180, thinking that by extension it would turn the right direction when I hit play.  No such luck.  It stayed butt first.   

forcevfx

  • Playmaker Newbie
  • *
  • Posts: 20
Re: Animation vs. Playmaker: Fight!
« Reply #4 on: June 30, 2011, 11:10:10 AM »
I went through hell with my models at first...
They would all snap back to 0,0,0 when playing animations..
among other wacked out behavior...
I was/am using maya -> motionbuilder pipeline..

turns out, there is the MOST important thing.

There has to be a node that is left UN-keyed..call it 'reference'
This is the node unity will use to 'Move your char/object'

if your root node has positional keys @ X,Y,Z positions,
and scripts then try to move to another position.
the animation position will always win out.

Reference (NO KEYS AT ALL)
   -root/hips(keyed)
   -abdomen/waist(keyed)
     -etc...

so now I can push out 100's of animations per character in minutes...

I will help you...send me 1 sample .fbx,
and will tell you exactly what is going on..

something I was playing with years ago..
http://forcevfx.com/motioncapture/UnivMoCap.asp

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Animation vs. Playmaker: Fight!
« Reply #5 on: June 30, 2011, 12:35:47 PM »
Nice infos, thanks for this!

 Bye,

 Jean