1 registered members (TipmyPip),
18,388
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Combined bone and vertex animations
#291109
09/23/09 13:14
09/23/09 13:14
|
Joined: Apr 2009
Posts: 248 Philippines
seecah
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 248
Philippines
|
Hi All, Can we combine both bone animation and vertex animation inside a loop? I provided the code snippet but as what I've noticed, it's only the vertex animation that works but the bone animations don't.. I try to read the manual on this but fails for many tries.. Assumes all variables used are already defined..
void catcher_animate()
{
//controls the speed of the propeller animation - bones
my._propellerspeed = speed_percentage * 100;
ent_bonerotate(my, anim_LeftTurbine, vector(my._propellerspeed, 0, 0));
ent_bonerotate(my, anim_RightTurbine, vector(my._propellerspeed, 0, 0));
//controls the turning angle of the submarine - vertex animation
// I need to handle animation turn here since I don't need a full turning
my._angleturn = 30*steering_percentage; //there are 30 animation frames in turning the submarine
if (my._angleturn < 0) { ent_animate(me, "TurnLeft", my._angleturn, ANM_CYCLE); } //turn left -value
else { ent_animate(me, "TurnRight", my._angleturn, ANM_CYCLE); } //turn right - value
}
Edited: This function is called inside a while loop.. How can I let the 2 animations run simultaneously?? Please advise..
Last edited by seecah; 09/23/09 13:17.
Can't is not an option™
|
|
|
Re: Combined bone and vertex animations
[Re: bart_the_13th]
#291414
09/25/09 06:01
09/25/09 06:01
|
Joined: Apr 2009
Posts: 248 Philippines
seecah
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 248
Philippines
|
Sure, the result is that the vertex animation will prevail, I can't see any movement from the bones animation.. But I'm pretty sure that my bone animation should also work since I've tried to comment the vertex animation and it worked..
Can't is not an option™
|
|
|
Re: Combined bone and vertex animations
[Re: seecah]
#291552
09/26/09 12:20
09/26/09 12:20
|
Joined: Aug 2008
Posts: 482
bart_the_13th
Senior Member
|
Senior Member
Joined: Aug 2008
Posts: 482
|
Quote form the manual, ent_animate percent : Animation percentage within the scene, 0..100. At 0 the first frame is selected, at 100 the last frame (which is identical with the first for cyclic animation).
It seems that when you turn left, your my.angleturn value is < 0, the manual says that the ent_animate percent range from 0 to 100. Maybe that's the problem. How about using abs(my.angleturn) like:
...
if (my._angleturn < 0) { ent_animate(me, "TurnLeft", abs(my._angleturn), ANM_CYCLE); } //turn left -value
else { ent_animate(me, "TurnRight", my._angleturn, ANM_CYCLE); } //turn right - value
...
or
...
if (my._angleturn < 0) { ent_animate(me, "TurnLeft", 100-my._angleturn, ANM_CYCLE); } //turn left -value
else { ent_animate(me, "TurnRight", my._angleturn, ANM_CYCLE); } //turn right - value
...
|
|
|
Re: Combined bone and vertex animations
[Re: bart_the_13th]
#291833
09/28/09 12:17
09/28/09 12:17
|
Joined: Apr 2009
Posts: 248 Philippines
seecah
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 248
Philippines
|
I've tried but it still doesn't work..
Can't is not an option™
|
|
|
|