Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Tween questions

Author
Message
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 2nd Feb 2016 13:02 Edited at: 2nd Feb 2016 13:12
Hello folks!
Recently I started to use tweens to get a train on a path running.
If I use tweenlinear() for interpolation, it works like it should. The train does accelerate correctly, but linear.
But once I use tweensmooth1(), it does not behave like I thought. It always stops at the
tween points. I thought tweensmooth1() will accelerate to the next speed, but it does an easeIn/easeOut in one tween.
Any Ideas, how to get smooth acceleration without using additional waypoints?

To explain the problem, I made a short video:


Thank you!
Jack

[/url]
BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Feb 2016 13:15
TweenSmooth starts slowly, speeds up and then slows down towards the end of the tween.
So what you are seeing is correct.

I tried to use tweens for the same purpose, but in the end I calculated the movement manually. Tweens were too jerky for track movement.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 2nd Feb 2016 13:34
Thank you BatVink for the quick response!

I was worried about an answer like this
So I have to write a custom tween library for a smooth acceleration or use a lot more waypoints to get it working.
The tween commands actually don't need so much work. Smooth acceleration, the chance to modify the attack rate of each tween and correct timing. (total time of all tweens does not fit the measured time)









[/url]
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 2nd Feb 2016 14:50
you could try using easeout to speed up, and easein to slow down... but I'd agree with BatVink and go for coding your own speed control method for this. Tweens are great for bouncing gui elements into place, or for quick transition fades, but a train speed control system is probably a little beyond scope. Not to say it couldn't be done, just that you will be limiting yourself to the algorithms used for the tweens, when you might need some finer control.

Looks like a really nice project by the way! Have you thought about using physics for the movement?
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Feb 2016 15:20
My equation is super simple:

inc pos#, td# * speed# / 100.0


where pos# is the current point on the track section (0.0 - 1.0), td# is the time since the last frame, and speed# is...speed!



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 2nd Feb 2016 15:22 Edited at: 2nd Feb 2016 15:24
I think you are right. A custom method would be the best and the only acceptable solution for a train speed control system. Physics may not be required at this point, because the path and the acceleration is already given. Actually I already have to use physics, even with tweens to calculate the time for them. Yes, the tween library is way too simple for this.

This project is currently a multi-purpose level-editor based on entities. You can add objects, paths and trigger right now. I would really like to add the most features of AppGameKit to it, but progress is slow due to the window and hud design. The greatest idea of all was to add all editor definitions and features by XML files, so I don't even have to recompile if I want new features, buttons or windows to it. I will keep you updated, once I make some progress in the custom tween method.

Greetings, Jack

[/url]
BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Feb 2016 15:36
Looking forward to seeing what you come up with!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 9th Feb 2016 21:19
Updated the bezier curve Library to 3d (just wanted to share)


[/url]

Login to post a reply

Server time is: 2024-03-29 09:08:24
Your offset time is: 2024-03-29 09:08:24