Author Topic: Keyframe-based animation  (Read 2422 times)

Offline VT900

  • byte
  • *
  • Posts: 10
    • View Profile
Keyframe-based animation
« on: December 27, 2010, 03:39:18 pm »
Hi,

I have a blender model that I animated and exported as seperate objs for each keyframe. Basically all the animation is, is a few things rotating about pivots and I had to check an option in the blender exporter which said "Apply Modifiers" or the keyframes would not carry the rotation information.

Now, that works well, I load each keyframe in an animation object and set the animation to my Object3D, and animate it each frame using obj.animate(index, 2);, etc. That works fine.

What I have done now is create a new object that is meant to surround the first object to a degree. I have basically taken that first model, extruded some sides and deleted the parts I did not extrude. I then exported that as an obj and loaded it in, and is displays fine.

However, I now need it to "latch on" to the first object, so that it rotates simulateously with the first object each keyframe. I could animate the second object manually in blender, but I may not get the rotation angles exactly right and also it will be really tedious to do this. I was thinking of using some better solution in code.

Any ideas?
« Last Edit: December 27, 2010, 04:27:16 pm by VT900 »

Offline fireside

  • double
  • *****
  • Posts: 608
    • View Profile
Re: Keyframe-based animation
« Reply #1 on: December 28, 2010, 04:49:37 am »
Maybe a picture would help.  If it's an animation, I don't think you can do much about it, so you might want to rotate the whole thing with code, though.  You should be able to sync two animations pretty easily, also. 
click here->Fireside 7 Games<-

Offline VT900

  • byte
  • *
  • Posts: 10
    • View Profile
Re: Keyframe-based animation
« Reply #2 on: December 28, 2010, 12:24:24 pm »
Yeah, I'm not too sure on how to rotate the separate parts in code though, and it would probably be best to somehow get the rotation angles from the first object and apply them in the same areas in the second object, since the second object is based on the first object but with a few sides extruded.

Offline fireside

  • double
  • *****
  • Posts: 608
    • View Profile
Re: Keyframe-based animation
« Reply #3 on: December 28, 2010, 04:37:07 pm »
What about just making them one object and exporting them that way?
click here->Fireside 7 Games<-

Offline VT900

  • byte
  • *
  • Posts: 10
    • View Profile
Re: Keyframe-based animation
« Reply #4 on: December 28, 2010, 05:33:40 pm »
Well, I need to swap the second object around - the user chooses which file the second object will be loaded from, so I need to keep the objects separate. So exporting the objects as one would be a disadvantage.

Offline fireside

  • double
  • *****
  • Posts: 608
    • View Profile
Re: Keyframe-based animation
« Reply #5 on: December 28, 2010, 07:16:02 pm »
Rotating in code shouldn't be that hard.  You can get the axis of the part and then rotate it around that axis.  I haven't done it, though.
click here->Fireside 7 Games<-

Offline VT900

  • byte
  • *
  • Posts: 10
    • View Profile
Re: Keyframe-based animation
« Reply #6 on: December 28, 2010, 09:04:25 pm »
How would I go about doing that? The objects are loaded in as obj models currently. How would I select the part that is meant to rotate? Do I have to export each separate part as a different object or is there a better solution?

Offline fireside

  • double
  • *****
  • Posts: 608
    • View Profile
Re: Keyframe-based animation
« Reply #7 on: December 28, 2010, 09:09:37 pm »
I would think you would need to separate the object that rotates and make that a different object and then do parenting to keep them all together.
click here->Fireside 7 Games<-

Offline VT900

  • byte
  • *
  • Posts: 10
    • View Profile
Re: Keyframe-based animation
« Reply #8 on: December 29, 2010, 02:32:12 pm »
I did this quickly and now get a warning:

WARNING: This OBJ-file contains n-polygons with n>4! These polygons wont be displayed correctly!

The actual model displays fine though, so I guess I left in a few polygons I shouldn't have. Any ideas on how to correct this in the obj file? I used a separate obj editor to separate the parts of the model. Is there some command line tool that will fix this? Other than that it works fine now.

Offline fireside

  • double
  • *****
  • Posts: 608
    • View Profile
Re: Keyframe-based animation
« Reply #9 on: December 29, 2010, 03:59:11 pm »
I don't know of any command line tool.  I know in blender you can press control_t on a selected model when in edit mode and all the selected poly's will be triangulated.  
« Last Edit: December 29, 2010, 04:05:44 pm by fireside »
click here->Fireside 7 Games<-