1 registered members (AndrewAMD),
1,135
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
bone animation
#266979
05/21/09 09:08
05/21/09 09:08
|
Joined: Mar 2009
Posts: 276 Cebu City, Philippines
boyax
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
|
Hi, I got here some problem with bone animation in my model. I have a model riding in a bicycle. So, turning left/right would also appear his shoulder bones and the bicyle turn left/right. But I got stucked since it appears the shoulder bones just move/rotate a small angle or seems not moving when turning left/right.. Here's the code:
action movePlayer()
{
player = my; //I'm the player
var dist_ahead;
var anim_percent = 0;
//vec_for_min(vFeet,my); // vFeet.z = distance from player origin to lowest vertex
while (1)
{
dist_ahead = 5*(key_w-key_s)*time_step;
c_move(my,vector(dist_ahead,0,0),nullvector,IGNORE_PASSABLE | GLIDE); // move the player
// animate the player according to its moved distance
if (dist_ahead != 0) // player is moving ahead
{
anim_percent += 1.3*dist_ahead; // 1.3 = walk cycle percentage per quant
ent_animate(my,"SlowPedal",anim_percent,ANM_CYCLE); // play the "slow pedal" animation
if(key_a)
{
// rotate the player using the [A] and [D] keys; play animation...
my.pan += 1*(key_a-key_d)*time_step;
ent_animate(my,"TurnLeft",anim_percent,ANM_ADD);
}
else if(key_d)
{
my.pan += 1*(key_a-key_d)*time_step;
ent_animate(my,"TurnRight",anim_percent,ANM_ADD);
}
}
isometric_camera();
wait(1);
}
}
So, turning left/right I use the mode: ANM_ADD Hope you can advise. Thanks
|
|
|
Re: bone animation
[Re: boyax]
#267043
05/21/09 15:24
05/21/09 15:24
|
Joined: May 2008
Posts: 331 Lithuania, Vilnius
Jaxas
Senior Member
|
Senior Member
Joined: May 2008
Posts: 331
Lithuania, Vilnius
|
AFAIK it's necessary to set different names of animation once i have similar problem, but change animation names and solve that problem
The smaller the bug, the harder it is to kill. _________________________________________ Forklift DEMO (3dgs)
|
|
|
Re: bone animation
[Re: Jaxas]
#267069
05/21/09 17:31
05/21/09 17:31
|
Joined: Mar 2009
Posts: 276 Cebu City, Philippines
boyax
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
|
I've tried your suggestion but didn't fix it. Actually, they are of different frame animation. Here's my animation sequence: SlowPedal: index 2-48 -> model is on pedal slowly the bike TurnRight: index 154-177 TurnLeft: index 181-204 So, in MED playing the animation, this how it looks TurnRight (front): TurnRight (back): What I want to do is that, when the model turns right, I'll be playing the SlowPedal+TurnRight animation. But when I run my code I didn't get the desired output? It seems it's not playing the TurnRight animation.. Sample output: I just follow the lite-c workshop on bone animation but it didn't work for me well. At first, moving forward I play the SlowPedal animation
ent_animate(my,"SlowPedal",anim_percent,ANM_CYCLE)
Then, when player turns right (key_d is pressed)
ent_animate(my,"TurnRight",anim_percent,ANM_ADD);
Is there something wrong with the code? Hope you could advise. Thanks
|
|
|
Re: bone animation
[Re: boyax]
#267078
05/21/09 19:13
05/21/09 19:13
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
My best guess would be the anim_percent values. Try separating them into separate counters, say, anim_pedal and anim_turn.
Just in case one has a longer "frame-set" than the other and so one keeps resetting the other when they share the same percentage variable.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: bone animation
[Re: boyax]
#267080
05/21/09 19:21
05/21/09 19:21
|
Joined: May 2008
Posts: 331 Lithuania, Vilnius
Jaxas
Senior Member
|
Senior Member
Joined: May 2008
Posts: 331
Lithuania, Vilnius
|
i just read in manual that ANM_ADD need to use with ANM_CYCLE: ent_animate(my,"TurnRight",anim_percent,ANM_CYCLE+ANM_ADD); try that
The smaller the bug, the harder it is to kill. _________________________________________ Forklift DEMO (3dgs)
|
|
|
Re: bone animation
[Re: Jaxas]
#267145
05/22/09 08:18
05/22/09 08:18
|
Joined: Mar 2009
Posts: 276 Cebu City, Philippines
boyax
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
|
Hi, I try the suggestions but didn't work well for me... Anyway, other solution I have is to rotate the spine bone when turning left/right. I'm able to locate the Spine bone. some questions: 1. When selecting the bone mode, rotate, hope someone could clarify me which is the x,y and z vertex? or is it pan,tilt,roll angles? 2. In MED, clicking bone mode, there's a toolbar below that shows the position of the vertex (bone): x,y,z, ?, name of the bone, mode, current selection What's the 4th refers to? I should be adjusting the blue arrow/vertex... but i'm not sure how I should do it adjusting the angle..? I just have to use ent_bonerotate( ENTITY*,STRING* name,VECTOR* angle) Any advise? Thanks
|
|
|
|