Right now I have my 3d model of human in Maya (also .egg) I have also an animation like walking and jump. I like add a sword to model’s hand.
Now I want to make an animation like fight where the model can swing the sword BUT I want to have few types of weapons (like bat). I have to make it with every type of weapon?
I hope you now what I meant. Like other types of games.
You can move a hero, then i push 1 or 2. When 1 hero gets his sword, on 2 I have a bat. And he use this weapon the same way when he fight. Thing that’s different is weapon model.
Any help with that?
Since a sword and a bat are rigid objects, it’s easier. You don’t have to animate the weapon, you just animate the hand. At runtime, you expose the hand joint (e.g. with actor.exposeJoint()), then you can parent the appropriate weapon to the exposed node. You can switch out the weapons as you like.
If you want to use a weapon like a flail or a whip that will require its own animation, it gets more complicated. In this case it’s probably easiest to include all such weapons with the model, then hide the ones that aren’t visible at any given time.
have a look at the samples which come with your panda installation. the “looking and gripping” one demonstrates exactly what you need.
drwr was a few seconds faster.^^
Things can get complicated depending on the weapon type. Try having a character wield a staff…tell me about…
You would think the easy way out would be animating the staff with the character…not so. Lets say you want the ends of the staff to have collision spheres…see the problem now? In this case, you would want the Staff to be a separate object so it can have it’s own collision solids.
The first remedy that comes to my mind is making the Staff another actor, then re-parent it to your character. Now you can simply play separate animations that work together in order to create the whole. Plus, you can easily add your collision solids to the Staff.
I never tried this next thing I’m going to mention… So if someone has…let me know… Is it possible to expose a joint (joint A) and re-parent another joint (joint B of another actor) to it? Like I said, never tried that, but if it doesn’t go, I’ll like to know that before I try it.
You would think you could add collision objects into the character file, in position at the end of the Staff and address these objects as collision objects once imported into Panda. I created a topic on this once and to no avail, so I assume it can not be done that way. If it can, please share the wealth… Um err… I mean code…please share the code.
You cannot parent the deeply-nested joint of actor B to a deeply-nested joint of actor A. However, you can parent the root of actor B to a deeply-nested joint of actor A, and if you wanted, you could use the egg-optchar tool to restructure your actor B’s hierarchy so that any given joint was the root joint. Or you could animate actor B along with actor A, and then use egg-topstrip to strip off the animation that it would inherit from actor A when you parent it to actor A’s joint.
For adding collision objects into a character file, the best way is usually to add them in separately after you have loaded the file. To make it easier, you can create a joint that indicates precisely where the collision solids should go, then simply parent them to that joint.
It is possible to load collision objects directly in a character file if you first process the egg file with “egg-optchar -dart structured”. However, this has other implications on performance which may or may not be an issue for you.
I have tested my theory of the two hand held weapon, with it’s own collisions at the ends of the weapon. This however, will not be a solution for MMORPGs. Since I’m developing a hardcore action, I can get away with this.
My theory was, if I made the two hand held weapon an actor, I could just play its animation for an action as I play the character’s animation for the same action. The two animations playing; one for the character and one for the weapon should play together as one.
It worked nicely!
It was a pain in the “arse” trying to figure out how to go about doing it using Blender. I tried moving the weapon around and key frame it against the character’s key frames. Didn’t work too good when testing because the weapon’s animation seemed to be snapping.
I figured I would have to ensure that the weapon’s animation keys were in sync with the character’s animation keys. That’s when trial and error took place. I was playing around with Blenders “constraints”, trying to find away to set the weapon in the characters hand or attach it to a spine; but at the same time, I needed the ability to manipulate the weapon’s rotation and position.
I finally figured it out; the “constraint” that works is the one called “child of.” I was able to attach my weapon to the character where ever I wanted it and manipulate the position. When I played back the character’s animation, the weapon followed along accordingly.
One last thing to do after that; you have to set weapon frame keys based on the character’s frame keys. Then you’ll be ready to export the weapon’s animation. Writing the engine codes to finish this up isn’t too hard or anything, so I won’t cover that. Just re-parent the weapon to the character and start the animations at the same time, with the same everything…play speed, to and from, and so on.
Now I can easily parent collisions solids to the weapon. Having the weapon as an actor on its own allows for some special effects as well; like the weapon my Main Character has…the blades on it extend and retract. The animating for that is simple do to the fact the weapon has its own skeleton. I can also attach things to the weapon using expose joint…like an enemy’s head.