Gun anims
|
|
Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
|
06-27-2007 19:50
before i used a list method where if i was running it would garb the default sl running anim and replace it with the anim I made. Someone said i can try a different method that is supposedly more efficient. here is what i tried but it's not working right, i dunno a way to get agent info for running. I wish they had that in there also for crouch walking. It'll play the walk but not the run. As before i was using a method to grab a list of anims playing and then replacing them with my anims. Having no probs using the old if(llGetAgentInfo(llGetOwner()) & AGENT_MOUSELOOK) for doing the gun holds and aims. if (llGetAgentInfo(llGetOwner()) & AGENT_WALKING) { if (llGetAgentInfo(llGetOwner()) & AGENT_ALWAYS_RUN) { llStartAnimation("gunrun1"  ; } if (llGetAgentInfo(llGetOwner()) != AGENT_ALWAYS_RUN) { llStartAnimation("gunwalk1"  ; } } else { llStopAnimation("gunwalk1"  ; llStopAnimation("gunrun1"  ; } if anyone can help please reply or IM me ingame. Thanks!
|
|
Pip Helios
Registered User
Join date: 29 Sep 2006
Posts: 22
|
06-27-2007 20:31
Can someone send me a anim that makes the avatar look like a gun? Cause that would be crazy. I could be like "I'm so bad if you fold me up I turn into a gun!" >.> yeah less sugar.
|
|
Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
|
06-27-2007 20:32
From: Pip Helios Can someone send me a anim that makes the avatar look like a gun? Cause that would be crazy. I could be like "I'm so bad if you fold me up I turn into a gun!" >.> yeah less sugar. hmm... maybe ask someone that makes transfomer like anims... Also, try sugar-free kool-aid!
|
|
Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
|
06-28-2007 01:47
Lol, can anyone elaborate? Is a bunch of if's better then grabing a list of anims that the av is playing? Also let me know if you have a good idea on how to get the running anim playing if I go with the if's solution or else i'll have to grab a list of anims then and replace.
|
|
Domino Marama
Domino Designs
Join date: 22 Sep 2006
Posts: 1,126
|
06-28-2007 02:49
From: Alicia Mounier Lol, can anyone elaborate? Is a bunch of if's better then grabing a list of anims that the av is playing? Also let me know if you have a good idea on how to get the running anim playing if I go with the if's solution or else i'll have to grab a list of anims then and replace. Yes this is a better approach. It can be improved further by only getting the agent info once, and as your code stands the walk animation is played regardless of running being being set or not. integer agentStatus = llGetAgentInfo(llGetOwner()); if ( agentStatus & AGENT_WALKING ) { if ( agentStatus & AGENT_ALWAYS_RUN ) { llStartAnimation("gunrun1"); } else { llStartAnimation("gunwalk1"); } } else { llStopAnimation("gunwalk1"); llStopAnimation("gunrun1"); }
Depending on where this code is you might be better doing a currentAnim, newAnim setup where instead of starting the anim you set the newAnim string then something like if ( newAnim != currentAnim ) { llStartAnimation( newAnim ); llStopAnimation( currentAnim ); currentAnim = newAnim; }
I'll leave adding AGENT_CROUCHING checks for you 
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
06-28-2007 03:16
Do we think that llGetAgentInfo is faster than llGetAnimation (not llGetAnimationList) ?
(I suppose there might be a slight win in processing the results, since with llGetAgentInfo the if statements can be nested, so if the distribution of results is more or less uniform, it's kinda like a (very short) tree search--but not if, for example, the avatars will be walking 50% of the time and running 49% of the time and one tests the llGetAnimation result first for walking and then for running.)
I've always been a little spooked by the comment in the lslwiki entry for llGetAgentInfo: "...this function only returns meaningful values (or anything, really) if your own object calls it while it's on your own land...." but don't know if that's correct or not.
|
|
Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
|
06-28-2007 03:19
Thanks for the input! It sorta works meaning it will change the anim for running but it seems to not actualy trigger it fast enough where it'll start out in walk then go to run but still be using the default run anim till i hit something like a bump in the floor and then it'll play the gunrun anim. maybe the timing is off in there somewhere within the anim engine in SL. Here is a lil snipit of the method you mentioned. if (male)//this is where upon answering the lil dialog pop-up asking if they are male or female, male true should play out the rest below. { if(agentStatus & AGENT_WALKING) { if(agentStatus & AGENT_ALWAYS_RUN) { llStopAnimation("malegunwalk1"  ;//added this to see if it would fix the above mentioned new prob. llStartAnimation("malegunrun6"  ; } else { llStartAnimation("malegunwalk1"  ; } } else { llStopAnimation("malegunwalk1"  ; llStopAnimation("malegunrun6"  ; } }
|
|
Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
|
06-28-2007 03:29
From: Alicia Mounier { llStopAnimation("malegunwalk1"  ;//added this to see if it would fix the above mentioned new prob. llStartAnimation("malegunrun6"  ; } lol, ok so i went and tried changing that stop animation to stop the sl default run anim and that seemed to work. But i'm stumped on the whole crouching part to make it play a crouching walk while crouching instead of using a list method.
|
|
Domino Marama
Domino Designs
Join date: 22 Sep 2006
Posts: 1,126
|
06-28-2007 03:42
From: Qie Niangao Do we think that llGetAgentInfo is faster than llGetAnimation (not llGetAnimationList) ? Yes. With llGetAnimation you are getting a string back, so something like if ( returnedAnim == "running" ) has to do a comparision with 7 characters. That's always going to take longer than a simple "&" test on a integer. I've not done any tests on this but I suspect storing the previous state and doing things like if ( agentStatus & AGENT_FLYING ) { if ( ! prevAgentStatus & AGENT_FLYING ) { newAnim = "takeoff"; } else { newAnim = "flying"; } } else if ( prevAgentStatus & AGENT_FLYING ) { newAnim = "landing"; }
will still come out faster if you need the less obvious animation states.. If you want to be sure code it both ways and use llGetTime() to benchmark it. and let me know result for future reference 
|
|
Domino Marama
Domino Designs
Join date: 22 Sep 2006
Posts: 1,126
|
06-28-2007 03:49
From: Alicia Mounier lol, ok so i went and tried changing that stop animation to stop the sl default run anim and that seemed to work. But i'm stumped on the whole crouching part to make it play a crouching walk while crouching instead of using a list method. Whether you need to stop existing anims or not will depend on the priority your replacement anims were uploaded with. replace else { llStartAnimation("malegunwalk1"); }
with something like else { if ( agentStatus & AGENT_CROUCHING ) { llStartAnimation( "maleguncrouchwalk1" ); } else { llStartAnimation( "malegunwalk1" ); } }
|
|
Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
|
06-28-2007 04:12
From: Domino Marama with something like else { if ( agentStatus & AGENT_CROUCHING ) { llStartAnimation( "maleguncrouchwalk1" ); } else { llStartAnimation( "malegunwalk1" ); } }
Yeah I tried that way and it just doesn't want to play the anim at all. All the walking anims are priority 3 while the holds are 2. Also for somereason stopping the default crouching stand anim changes the crouching status. Weird, i dunno why though. I gues the only other way for changing the crouching walk would be to llGetAnimation.
|
|
Domino Marama
Domino Designs
Join date: 22 Sep 2006
Posts: 1,126
|
06-28-2007 05:09
From: Alicia Mounier Yeah I tried that way and it just doesn't want to play the anim at all. All the walking anims are priority 3 while the holds are 2. Also for somereason stopping the default crouching stand anim changes the crouching status. Weird, i dunno why though. I gues the only other way for changing the crouching walk would be to llGetAnimation. Yeah, it doesn't seem to work. I'm just coding a full test for all the possible return values, but it looks like AGENT_CROUCHING isn't set if the avatar is walking. This looks like a bug to me. Edit: Confirmed that it doesn't work as expected. I've raised a bug report so feel free to vote it up https://jira.secondlife.com/browse/VWR-1419In the meantime, you will have to use the llGetAnimation call to workaround this.
|
|
Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
|
06-28-2007 07:08
Thanks for your help and time. I went and voted on the jira thing. Lol, need sleep before I fall over. 
|