Buggy animations - quick enter and exit from trigger

Buggy animations - quick enter and exit from trigger

Postby Konke » Sun Jun 03, 2018 5:17 am

Hello! I'm trying to get a couple of robot arms to animate open and close. They should pop out of the floor when the player gets into a trigger_multiple. I've set it so the arm uses the open animation when the trigger is set to OnStartTouch and when the player exits the trigger lets the arm close via OnEndTouch.

No to the issue: when the player get in and out of the trigger quickly the animation starts to bug. It feels choppy and the arm might even get stuck in the open animation's idle state when the player has left the trigger. Is there a way to get the animations run properly and smooth? Thanks in advance!
User avatar
Konke
Mantisman
 
Posts: 161
Joined: Mar 2, 2014
Location: Stockholm, Sweden

Registered users don't see ads! Register now!
 

Re: Buggy animations - quick enter and exit from trigger

Postby Kwinten06 » Mon Jun 04, 2018 5:46 pm

First, make sure that you've set the "Hold animation" to "Yes" and default animation to BindPose (sometimes it can be different, check in model tab what is the default animation used by the model)
-> That will avoid to your model to be stuck in-anim

For the trigger thing, if the solution above isn't enough for the arms to work properly, i would suggest to play with delays
(add 2 transition logic_relay and use the "cancel pending" option of it at your own advantage) :)
User avatar
Kwinten06
Defective Turret
 
Posts: 40
Joined: Sep 9, 2015
Location: France

Re: Buggy animations - quick enter and exit from trigger

Postby Konke » Fri Jun 08, 2018 1:12 pm

Kwinten06 wrote:
First, make sure that you've set the "Hold animation" to "Yes" and default animation to BindPose (sometimes it can be different, check in model tab what is the default animation used by the model)
-> That will avoid to your model to be stuck in-anim

For the trigger thing, if the solution above isn't enough for the arms to work properly, i would suggest to play with delays
(add 2 transition logic_relay and use the "cancel pending" option of it at your own advantage) :)


Sorry for the late reply. I'd be interested in trying out the 2 transition logic relays. How do they work and how do I set them up? Don't think I have any experience with them.
User avatar
Konke
Mantisman
 
Posts: 161
Joined: Mar 2, 2014
Location: Stockholm, Sweden

Re: Buggy animations - quick enter and exit from trigger

Postby Konke » Sun Jun 17, 2018 5:39 am

Anyone? :)
User avatar
Konke
Mantisman
 
Posts: 161
Joined: Mar 2, 2014
Location: Stockholm, Sweden

Re: Buggy animations - quick enter and exit from trigger

Postby DaMaGepy » Mon Jun 18, 2018 2:21 pm

With any animation where there is a chance to reverse the animation before it completes (when leaving then it "jumps" and starts from the fully opened anim, looks bad and buggy), the solution is to set the closed "animation" (idle) as bindpose, set set hold animation ON, and then in trigger:
OnStartTouch: armname SetPlaybackRate 1
OnEndTouch: armname SetPlaybackRate -1

and with a trigger auto (starts once with map):
OnMapSpawn: armname SetAnimation whatever_opening_anim_name 0.01
OnMapSpawn: armname SetPlaybackRate -1 0.02

- the first sets the opening anim
- the second makes sure that it stays in the starting position

Basicall there is only the opening anim, it plays with speed 1 when activated (SetPlaybackRate 2 is 2x faster, 0.5 is 2x slower)
When you leave the trigger halfway of the animation, it just reverses the animation with the negative speed, wherever the anim is, it just reverses, no jumping or blinking, if its 70% played then plays back from there if just started then will juts move back. Looks smooth, can be activated without prob. If someone enters/leaves superfast then you can make 2 relay, 1 for opening 1 for closing and then just call the opening relay from the trigger while also canceling the other trigger's pending (cancelpending), and same for the closing relay but should not be a problem whithout this.

Good for opening staircases where for exmple a button activates them. It makes the anim smooth. I used it in my map #4 (cube training) room 6 or for example no money for chambers 2 last laserrelay grid (a math counter sets speed plus and minus), you can download the vmf source of those maps from the workshop description, my map #4 used relays to activate the stairs but in nomoney2 justcalling one single prop directly on and off (playbackanim) was enough.
-= Check out my maps: workshop, and their .vmf sources: homepage =-
User avatar
DaMaGepy
Community Contributor
 
Posts: 381
Joined: Oct 26, 2007
Location: Hungary

Re: Buggy animations - quick enter and exit from trigger

Postby Kwinten06 » Tue Jun 19, 2018 12:42 pm

Oh i didn't think of the SetPlayBackRate thing
Well all is explained now :D
User avatar
Kwinten06
Defective Turret
 
Posts: 40
Joined: Sep 9, 2015
Location: France

Re: Buggy animations - quick enter and exit from trigger

Postby Konke » Sun Jun 24, 2018 9:20 am

Thanks a bunch! I sure worked with DaMaGepy's suggestion and I seem to be good without the CancelPending command. When is it recommended to add that command?

The only negative thing I can come up with, working with SetPlaybackRate, is that it won't play a close animation if it is different than just playing the open animation backwards. Haven't checked the animations too closely if the animations mostly are this way or not. Perhaps someone knows more.

In any case, so far so good.
User avatar
Konke
Mantisman
 
Posts: 161
Joined: Mar 2, 2014
Location: Stockholm, Sweden

Registered users don't see ads! Register now!
 

Return to Hammer and Modding



Who is online

Users browsing this forum: Majestic-12 [Bot] and 2 guests