Hi evryone. How can I make a character while running, walking can take out his gun and aim at its target with the mouse, when hitting a key on the keyboard.Should I separate the upper body from the bottom? Or can it be a single character and control the upper body. How can it be done? in most of every game this can be done.
If you make an action that only has keys for the arms, you can run 2 action actuators at once, with the arms action at higher priority, and the arms action will leave the legs to do their thing. No need to split any objects.
I try as you say but it didn’t work. Here is the blend
,please can anyone show me what am I doing wrong, the action is " attack " ? Also about the jumping motion. Why when continued pressing the key " spacebar" it continued going up. How to in just one click, it jump and return on the ground imediately even the key is pressing continously.
Ive done a setup like this in the past, its best to not separate the object, but to instead make 2 separate armatures, one for the legs and lower body, with the upper torso and arms parented to that.
That way you can have the run cycle working on the legs at all times, and then only working on the body when the character isn’t doing something else (say shooting or punching) Easily set up with the priority settings mentioned above.
I did it for a link model, because it had to be able to run while swinging a sword. Worked fine.
2 separate armature? Please can you post a simple blend showing it, the 2 separate armature that I try can’t control the same mesh.
Sorry, looks like you will have to break it into different objects.
The zelda model I made was broken into a bunch of different objects, each parented to 2 different armatures. Maybe you could make a split at the waist, have a belt or something cover it. As long as theres not much movement at the split it should be fine.
Is it passible to achieve the option that Captain Oblivion mention above? I don’t know how it work, please check my blend file, I will have to restart the modeling and all logic if I split the body part. How about the jumping problem I mention above?
the method captain oblivion mentioned is working,
but i would advise you to pack all of those keyboard controllers to one python script.
so instead of having four and controller you will have only one python script.
the details how to achieve this are scattered across the whole web, just one quick example:
g = GameLogic c = g.getCurrentController() o = c.owner #select the sensor called sensor1 sensor1 = c.sensors["sensor1"] sensor2 = c.sensors["sensor2"] #select the actuator called actuator1 actuator1 = c.actuators["actuator1"] actuator2 = c.actuators["actuator2"] #sensor1 is the keypress sensor, so it is set to positive when the key is pressed if sensor1.positive: #activates the actuator, the char walks c.activate(actuator1) else: #deactivates the actuator, the char stops moving c.deactivate(actuator1)
this script will do the same thing, your and controllers do atm, so you can just change the names of the actuator and the sensor in the script and exchange the ands with it.
if you feel adventurous you can modify the script to listen to all the sensors and to activate all the actuators and use only one script for the character control. as you see i declared sensor2 and actuator2, so by just copying the if:else: block and renaming the vars you should be able to activate and deactivate actuator2.
just adding the other sensors and actuators to the script should be easy, once you accomplished to activate actuator2.
the jumping can be controlled by setting the sensor which controls space to Tap and uncheck the first button of this row with the three ‘’’ that way your sensor will only call once per keypress.
if you have any questions unanswered pm me, i dont know if i will find back to that post ^^
Thank Manarius. I do exactly what you advise me for the jumping problem, it didn’t work. I press the " tap" and uncheck all the ( ‘’’ ) button. Sorry if I ask too much, can someone make the modification to the blend file i post? Please as for the python script i’m a zero. How to achieve it only with logic? However I will try it.
Take a look at Rorkimaru post at this thread: http://blenderartists.org/forum/showthread.php?t=151353
Never thought of doing that, sounds efficient. Something to look into I bet…
Hey I got it to work, I think the problem come from the blending option, I increase all to 0 , and also because I use IK for animate the bone. Their is a bug by using IK and blending mode in blender. However I still has problem to solve the jumping motion. It still goes up while pressing the jump key. Anyone knows how to get it to work?