I have an armature, I have a mouse script. I want the arms to follow the mouse but still be animatable by the armature like in GTA. This would be really easy if you could use the trackTo constraint on single bones in realtime like you can do in non realtime animations. All you would have to do is track the bone to an object controlled by the mouse script. Is there any way this would possible with the current game engine. My game will be pants without it. Cheers
I’ve never played GTA, but if you’re talking about something like the 3rd person animations in half-life, )where the legs and upper body can be animated seperately,) you can do that in Blender 2.25.
You can make seperate animations for the upper and lower body, and then mix and match them together. Two actions can only be blended if they don’t have overlapping channels, (don’t use the same bones,) and if they have the same priority setting though, so you’ll have to consider that when setting up your game logic.
But you can’t make the arm armatures track where you are aiming, you have to either fake it by setting frames and playing animation, probably possible but a lot of work. A nice track bone actuator would be so much nicer:)
I would say you have an action always playing that defines keys for looking all the way down, and all the way up. Make this always be playing, with some blending, make it have medium priortiy, and when you move the mouse up you increase the frames, when you move the mouse down you decrease the frames.
You can use an action actuator set to “property” mode, then make a prop on the character that will set the frame. Have your mose script set the property to the correct frame depending on where the mouse is (i.e, mouse at top, frame 0, mouse at bottom, frame 10, for instance, using 0 for looking all the way up and 10 for looking all the way down). I think it will be hard to get it to blend well with the other animations but I think it’s possible, especially if you don’t use keys for the bones that you animate in any other actions. Say, if you set keys for the arms in the “look” action, don’t set keys for the arms in the “walk” action.
I made a robot that aimed up and down at the player by using an extra bone in his waist with a 180 degree animation. (the animation rotated 1 degree for every 1 frame,) It was then easy to get the angle to the player in degrees and set the property to play the animation for that frame.
Since I used an extra bone the robot could tip at the waist to aim at the player and still play his shooting and walking animations.
Unfortunately I no longer have the file, but remember, it is possible, I’ve done it.
thanks for the replies, im not too good with python but what would i need to type detect mouse movement in a certain direction.
Just make 2 objects, one the legs, and another one the upperbody with arms, head and more. Then 2 armatures, one for the legs, and two for the upper body. Then parents the objects to the armatures, and the armatures to an empty, notice that the lower vertices of the upperbody must be connect to the armature of the legs, so that you wont see a cutoff. Then add python mouse movement to the armature of the upperbody, and add movement controls to the empty which will be an actor.