Page 1 of 1

guided jumps in tracks

PostPosted: 15 Sep 2019, 15:39
by sommejul
Hi,
can anyone tell me how to make a track in blender where you have guided jumps such as in other tracks like cornfield crossing where you jump into a barn.

thanks in advance,
sommejul

Re: guided jumps in tracks

PostPosted: 16 Sep 2019, 03:31
by tempAnon093
Those are called Cannons in the documentation.
https://supertuxkart.net/Physics#Cannons
Read though that page to learn how to make them and feel free to post again if you need more help. It could also be useful to download the Cornfield Crossing track from the Media repo if you want to see how it was created.

(PS: here's a fun little feature I made using cannons: YouTube video)

Re: guided jumps in tracks

PostPosted: 18 Sep 2019, 01:50
by jin
The teleport could be very useful and creates new possibilities for track making!!! @tempAnon093, is it possible to make one straight track and teleport back to the start? So each lap will not be a closed loop.

Re: guided jumps in tracks

PostPosted: 18 Sep 2019, 07:26
by deve
You can write script file. There is teleport() function for kart. And you can execute it as interaction to an object (in theory, untested). But I think cannon would work better (visually more smooth than teleport).

Re: guided jumps in tracks

PostPosted: 18 Sep 2019, 09:25
by tempAnon093
jin {l Wrote}:The teleport could be very useful and creates new possibilities for track making!!! @tempAnon093, is it possible to make one straight track and teleport back to the start? So each lap will not be a closed loop.


deve {l Wrote}:You can write script file. There is teleport() function for kart. And you can execute it as interaction to an object (in theory, untested). But I think cannon would work better (visually more smooth than teleport).

I tried this with cannons before I started learning how to script, so I haven't tried teleport(). When I saw that function, I knew I should have tried that sooner!

I know with cannons you can use it to teleport long distances like you say, although I think if you want it to be instant (that is, extremely, extremely fast; no problems if you just want 'less than a second') then you can only go so far because I've seen crazy glitching once I take the speed somewhere above 10000 or so. That would be a great use for a texture collision which calls teleport() instead, teleport shouldn't have that issue.
Also, I don't know if teleport() does this or not, but cannons also swivel the camera to follow the kart once it arrives, so it's much smoother to make it finish going the same direction as it starts (eg. straight line cannon).

You can make a straight track and teleport back to the start using either cannons or teleport(), absolutely! The harder part is doing that in a way that is smooth to drive through (if that matters to you).

Re: guided jumps in tracks

PostPosted: 18 Sep 2019, 10:07
by deve
I'm not sure if it's documented somewhere, all functions are available in:
https://github.com/supertuxkart/stk-cod ... _track.cpp
https://github.com/supertuxkart/stk-cod ... t_kart.cpp
and some other files in this directory. You can search for "engine->Register"

There is not much working examples, but you can see eg. overworld, tutorial or ScriptingPlayground in wip-tracks.

Re: guided jumps in tracks

PostPosted: 18 Sep 2019, 23:12
by deve
I added teleportExact() function, because teleport() didn't work good for me. But you need current git STK for it. And in attachment you can see portal example. Maybe it would be even better when using action trigger and ghost objects.

Re: guided jumps in tracks

PostPosted: 19 Sep 2019, 02:49
by tempAnon093
deve {l Wrote}:I added teleportExact() function, because teleport() didn't work good for me. But you need current git STK for it. And in attachment you can see portal example. Maybe it would be even better when using action trigger and ghost objects.

Speaking of action triggers, I sent an email to dev list regarding an issue with action triggers kart_id when you have more than one kart.
I should make a git issue about it later today.