Is there any way to stop an Interpolate once it has started?
ShmirlyWhirl
Member Posts: 189
I have an actor with drag that I apply velocity to. When the velocity gets below a threshold, I have the actor interpolate its position to a specific point.
I then apply a velocity to the actor, but it doesn't seem to take effect until after the actor has finished interpolating. I've tried having the interpolate behavior in various rules, but to no avail.
Is there any way to override the interpolate?
Sorry if this is confusing, I would be more than happy to clarify.
I then apply a velocity to the actor, but it doesn't seem to take effect until after the actor has finished interpolating. I've tried having the interpolate behavior in various rules, but to no avail.
Is there any way to override the interpolate?
Sorry if this is confusing, I would be more than happy to clarify.
Best Answer
-
Braydon_SFX Posts: 9,273Nope, nothing that know of. Unless you destroy that actor.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Answers
@ShmirlyWhirl
Hi, A small point to mention: velocity is "made" if you're interpolating an actor's position over time; in other words, when its moving, it has a velocity, so if you add a velocity change if your interpolating an actor's position, it won't kick in until the interpolation has finished...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I get what your saying, but this is what I found playing around with it.
I set up a scene to play around with it. I had a test actor interpolate its position. I can change its velocity while it's interpolating, but that does not affect the actors motion until it has finished interpolating.
Yes, sure, it's because in that case by interpolating an actor's distance over a time creates a velocity value, and this will take precedence over any other velocity attribute.
But for interest, if you wanted something else to be happening to your actor during an interpolation involving velocity, then providing it's not to do with velocity, it'll be OK.
An example:
Timer: After 2 seconds
Change attribute self.Color.Alpha to .4
--
Interpolate self.Position.X to 480
Duration 4 seconds
And two interpolates will work together too...so just not those moving with added change of speed...
Hope this is of some sort of help... (although doesn't answer your question regarding stopping an interpolate)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Yes, Master
:-))
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Try making your interpolation duration a variable. Then, when your event happens, set that variable to zero. The interpolation should stop and you'll be free to do with that object as you please.
@RacetotheMoon Hi, that would be great, but unfortunately, changing the duration to zero, it'll stop the interpolation OK, but the actor will then jump to its final set destination.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
http://forums.gamesalad.com/discussion/21933/interpolation-revelation#latest
Cheers
Aaron
@tenrdrmer Looks interesting approach, Aaron; it'll be interesting to see if your solution is similar to mine. :-) I'll check it out now. @RaceToTheMoon Yes, you're right, there's more to it than just the duration set as an attribute... the destination as an attribute too, as you say, and a constrain needed, as I discovered. :-)
@ShmirlyWhirl Anyhow, this was intriguing me so I did a little test, (before I looked at the files from @tenrdrmer ) and made game file to stop an interpolate with a mouse click; hopefully it can be modified for your use.
Edit: excellent solutions from @tenrdrmer and although mine's is a bit different; all might be useful in different situations, hopefully.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
However, thanks to @gyroscope and @RacetotheMoon, I was able to get the result I wanted by having the duration be a variable and changing it to zero.
Thanks guys, I would have never thought to try that.
EDIT:
I take that back, occasionally it still snaps to the end position. I'll play around with it, see what I can come up with.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User