Inconsistent results with interpolate and X-positions?
Tiny_Ideas
Member Posts: 326
Hello,
I have an issue that I need some advice on. I am using the interpolate behaviour.
Here is the situation:
An actor is at rest at X-position 600,
After doing some calculations it references a table cell that contains its next position.
It then interpolates from 600 to 305 in 0.2 seconds.
It then does a quick bounce effect as it hits the wall by going back plus 15 in 0.1 seconds then going back to its original position in another 0.1 second
However this only works 3 out of 7 times. I decided to track the x position and found that when it didn't work it went to 305 correctly, but then only went to and stayed at 318, instead of going to 320 and then back to 305.
That led me to believe the problem is with the last movement which works based on these rules:
When self.foundID is TRUE (found a new position)
Interpolate to new x position in 0.2 seconds (305)
Timer: After 0.2 seconds change self.Move to TRUE
When self.Move is TRUE
Interpolate to new position plus 15 in 0.1 seconds (320)
Timer: after 0.1 seconds interpolate to new position in 0.1 (305)
Anything that I should be considering or trying or have done incorrectly?
Jeromy
I have an issue that I need some advice on. I am using the interpolate behaviour.
Here is the situation:
An actor is at rest at X-position 600,
After doing some calculations it references a table cell that contains its next position.
It then interpolates from 600 to 305 in 0.2 seconds.
It then does a quick bounce effect as it hits the wall by going back plus 15 in 0.1 seconds then going back to its original position in another 0.1 second
However this only works 3 out of 7 times. I decided to track the x position and found that when it didn't work it went to 305 correctly, but then only went to and stayed at 318, instead of going to 320 and then back to 305.
That led me to believe the problem is with the last movement which works based on these rules:
When self.foundID is TRUE (found a new position)
Interpolate to new x position in 0.2 seconds (305)
Timer: After 0.2 seconds change self.Move to TRUE
When self.Move is TRUE
Interpolate to new position plus 15 in 0.1 seconds (320)
Timer: after 0.1 seconds interpolate to new position in 0.1 (305)
Anything that I should be considering or trying or have done incorrectly?
Jeromy
Comments
Hi @Jeromy, Interpolate behaviour is pretty much watertight and reliable so I reckon there's something else going on...
Another thing, I'm not sure why you need the attribute self.Move....
OK, try the following: make a real attribute called PosX (not totally necessary but might be useful later on especially as new x positions are called from a table)
So hopefully the following amendments will help >>
When self.foundID is TRUE (found a new position)
Change Attribute self.foundID to false ---- needed to change to true again to trigger the next x position from tables?? ----
Interpolate to new x position in 0.2 seconds (305)
Change Attribute PosX to self.Position.X
Timer: After 0.2 seconds
Interpolate to PosX + 15 in 0.1 seconds (320)
Timer: --nested within above Timer-- After 0.1 seconds
interpolate to PosX in 0.1 seconds (305)
-----
And as a test put self.Position.X into a Display Text behaviour and hopefully you'll see it'll be what you're after.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Just updated to 10.4 from 10.3 and it works 8 out of 10 times, so that's good and strange.
Thanks for your recommendations, originally that how it was set up, but more variables came to play and only certain events so thats why the extra rule is added in.
Well I didn't think it was the interpolates, but it works fine 100% when I turn off the timers. It also works perfect for every other block which has the exact same code expect for the first one. They are all spawned so its really got be puzzled as to why its only happening on one block and not all the time.
Great to know there is nothing wrong with the interpolate behaviour, makes it easier knowing that the fault is at my end and I can find and fix it.... Someday.
Jeromy