Animated Mesh Morphing

Blitz3D Forums/Blitz3D Beginners Area/Animated Mesh Morphing

Cubed Inc.(Posted 2010) [#1]
For my game, I am trying to make it so that when you run, your legs smoothly turn towards directions depending on what arrow key you press, but your characters top half remains pointing in the direction of which you mouse is pointing(the PC version of GTA Vice City shows an example of this).It is also commonly seen in PC 3rd person shooter games.

I thought of making the character model's running animation cycles different for each direction you point, but then I thought that it would be uneccesarily tedious and choppy.

For a little while, I was stumped, when then I remembered that Blitz3d has mesh morphing functions(if I am correct).
Could I perform the control type that I'm trying to achieve in my game
using Blitz3d mesh morphing functions?

If so, then how?


stanrol(Posted 2010) [#2]
I have code here somewhere in a book y André Lamothe.


Matty(Posted 2010) [#3]
Some simple ways:

1 way - Create two animated meshes, one for waist down, one for waist up, animate them separately.

2nd way - Find the 'waist/hip/abdomen' joint which is the parent of the upper body skeleton and simply rotate the joint after calling the updateworld command.

No idea what you mean by mesh morphing functions - there's no point in deforming the mesh by altering vertex coordinates for something like this.

I'm sure there are other solutions to your problem which other people will suggest.


Cubed Inc.(Posted 2010) [#4]
Matty
I still think that making 2 seperate animated meshes for just one character would be more difficult to handle and would cause problems later on.
As for the "mesh morphing" functions in blitz3d, I got the idea that blitz3d had them from this little(or not so little) example that came with blitz3d when I purchased it.



Also, as for your second suggestion, I didn't even know that blitz3d had functions to control the joints of animated mesh. What are the functions? Also, does the animation program you use affect the functions?

This thread is like digging up lost treasure for me:)


Matty(Posted 2010) [#5]
Joints in blitz are basically pivots, in a child-parent relationship as set up in your modelling program. As such you can use the 'find-child' and 'get-child' commands to locate a specific bone/pivot (ie 'left-arm' for instance) and rotate / turn / scale as you would with any other entity. It is also useful for attaching items to bones...ie put an object in the character's hand is as simple as parenting the object to the character's hand bone.

However, if you have animation already in the entity from your animation program then this will override any of your own rotations of the joints when updateworld is called, and so you will need to do all your joint rotations/movement etc after the updateworld command.


Ross C(Posted 2010) [#6]
You could record all the bones rotations for animations, and manually set the bone rotations for different parts of the body, depends on what animation is playing. It shouldn't be too difficult to implement an interpolation system, between keyframes.


_PJ_(Posted 2010) [#7]
This is the kinda route I need to take for animating since I am useless with 3D modelling software anyway.
It takes a bit of time to get into, but ultimately, gives you a good deal of precise control, You can check collisions and all sorts as you go, something that pre-animated animations don't necessariuly deal with,


stayne(Posted 2010) [#8]
I think the old md3 models (Quake 3 Arena) were done that way.


Cubed Inc.(Posted 2010) [#9]
Matty
Can you show me an example of using the "get child" and "find child command"? I never really needed to use the function before, so I just didn't mind it so much(big mistake). I tried looking it up on in the blitz3d website, but it didn't explain very well. Even the actual book manual didn't do such a great job at explaining.

So could you at least explain when and where the function can be used or token place. I'll be more than willing to supply my own animated models, and the help would be greatly appreciated.


Drak(Posted 2010) [#10]
This is a code snippet from a program of mine. It's an rpg and each npc is stored in a type. One of the field types holds a reference to the npc's thorax bone, which I can then access and modify very easily as I see fit, even while the model is animating.

You won't need GetChild() for this.

When I setup the type, I store the reference to that bone like this:
(I also know that the bone I want is actually named "Thorax" in my modeling program.)
n\thorax_bone = FindChild(n\mesh, "Thorax")


I can then access the thorax_bone easily later, and modify it to suit particular situations.

For example, if I wanted to point that particular pivot at any target entity:
PointEntity(n\thorax_bone, target_entity)


Note that this 'manual' manipulation of the bone MUST be done after UpdateWorld is called, or it will not have any effect.


Cubed Inc.(Posted 2010) [#11]
Drak
Thanks to everyone, works like a charm!