Say I’ve got a hominid rig, and a bunch of hitboxes are attached to it as separate child objects. How do I make an action that will move the hitbox children along with the main body? Like, how can I make it so a cube used for detecting punch-collisions moves along with the fist its working for in an Action?
Simply parent the hit box to the fist bone
You need to parent the hitbox objects to the corresponding armature bones.
The easiest way is to go to your armature in edit mode. Select the bone you want to parent to hit box to and leave edit mode. Then select the hitbox, then the armature holding shift and press CTRL+P and select “bone”. This way the objects are always parented to the bone that was active in the armature and maintain their location if you already have them set up properly.
This is a lot to ask for, but how would I set up a cube with a sphere as a hitbox? I just need an Action that makes the sphere move around the cube, for testing; nothing complex, but beyond my understanding of animation. ^^;
To make something a hitbox of another thing is trivial. It is a programming task: rayCast hitobject returns the hitbox object and the code links it to the correct object that stores the health property before proceeding.
To make an object move with another object you usually just use parenting. You want object to move with another object you parent to object. Simple as that.
I just need an Action that makes the sphere move around the cube
From that I can’t really tell what kind of setup you want to try and most importantly why?
In general for making sphere revolve around a cube you could:
Make an empty in the origin of the cube and parent the sphere to the empty and the empty to the cube. Then place the sphere next to cube. Now as you rotate the empty the sphere revolves around it and keyframe the rotation or modify rotation in game engine.
Make an armature that has one bone. Move the sphere next to the cube. Parent the sphere to the armature bone. Then you can rotate the sphere around by posing the bone and you can keyframe the pose.
Make it all in code. Calculate orbit coordinates with r^2 = x^2 + y^2 + z^2 equation and modify them sin / cos functions.
Oh, I’m just laying the groundwork for a fighting game I’m making. All I need, at this stage, is a few super-simple animations as proofs of concept. Once I got the sphere to go around the cube as an idling animation, I’d make a simple “punch” and a couple others.
The animation-logic I want to implement depends on having neat little Actions to index everything, but I can’t get them to manipulate more than the object they’re directly assigned to. ^^;
UPDATE: Yeah, I have no idea what I’m doing with this armature. I’ve trying to do what you say, but it’s just not working.
Is this about right? I have the Action controlled from the cube, but executed within the armature. Trying to use an actuator within the cube didn’t work: is that normal, or am I screwing up?
bone1.blend (522 KB)
You need to use actuator with the object that has the action, otherwise it won’t work. In this case the armature.