Get an object to follow a track with user input allowing it to temporarily leave that track
I am trying to create a mine cart level like in Donkey Kong country, where it constantly moves forward along the rails unless the player hits a button to jump. I have set up a mover to make it move forward, and I have set it so it doesn't move out of a 2d plane, but the cart doesn't stay on the track all of the time. If there is a drop, it falls off the drop, but I want it to stay on the track. If there is a bump, it will throw it off, but I want it to stay connected like a cart would to tracks, but still have the ability to move off when the player jumps, and come back to riding the track. Kind of like a magnet that I can turn off. How would I do this?
-
You could make the cart a puppet. Disable procedural animation and make it run into one direction with the puppet sensor. You could then try auto jump or put a trigger zone before a drop and make it jump via a mover.
-
add a mover to constantly apply a downward force to keep it on the tracks, then when you press the jump button you turn that force off and apply an upward force instead?
-
You can do a couple of things dependant on how much effort you want to put in. Best thing I can think of is to use an action recorder on an invisible cube with a tag on it. Record the cube going along the track. Then on the cart use a follower and have it only follow on the x and z axes.
The cart should follow the cube but only in the direction it goes and not up and down. If you have the rails going up you could keyframe it so in that section the follower is following up and down also (which would temporarily disable the jump). You could also modify this so that you have many keyframes on a timeline that dictate where the cube is on the track then using some logic you can plug in a positional timer output to the playhead of the timeline to make it so the player can control cart movement. -
So glad to hear you are working on such a thing EcrapeNahte! :) I am working on a "Roaring Rapids" type ride and having all kinds of similar struggles and have changed my idea of how to get it to work the way I'd like about 10 times.
Please sign in to leave a comment.