Download

Seeking guidance for movement system (spline locked, side on, free "flight")

Hi all,

I’m hoping some of you guys will be able to help me out with the initial movement setup for an idea I want to develop. I’ll start by explaining that I am an artist with no code experience, so blueprints are still pretty baffling to me. I’ve spent a good while playing around with the sidescroller demo and have yet to achieve what I’m after.

The basics movement I’d like to implement initially is best seen in the old Sega Saturn game NiGHTS into Dreams (http://www.youtube.com/watch?v=bJL0oSw8ZMs#t=491). Beyond that I hope to have learned enough to continue on my own.

This can be broken down into:

  • Movement is locked to a plane/track. Whilst the sidescroller template locks the players movement in one axis of the world, I would like to be able to place splines in the world that loop and define where the player/camera is locked to. You can always move left/right and view the character side on but the tracks moves throughout the environment.

  • Movement should not be locked to the floor but rather free flight within the plane of the track mentioned above. I made some progress on getting this work work using the sidescroller template by adding a water volume and having the character “swim”, but the rotation I achieved was not ideal. The character should re-orientate to the direction currently being pushed on the left stick. If the stick is released then movement should stop (ideally with some drift/deceleration), the character re-orientates to being upright and a very low amount of gravity kicks in so that they gently fall back down to earth.

If anyone can suggest methods to achieve any or all of this goal I would be very greatful and will hopefully learn plenty in the process.

Thanks.

This is where I got up to using blueprints and fudging things by rotating the character mesh. As you can see it doesn’t really achieve what I’m after as the orientation gets a bit screwed up (watch out for the left and right movements and the different ways the character faces when doing this each time).

Another issue is that no matter what I try with surface types and other settings, all collisions seem to have 100% friction. Not too worried about that right now.

https://www.youtube.com/watch?v=WzN-Ya3JzwE

It sounds like maybe you don’t want to use the Character class at all, as you don’t need the ‘walking’ behaviour that it provides. Maybe just start with a ‘Pawn’ based Blueprint and implement all the movement logic yourself (like the Flying template). You could place some ‘marker’ actors in the level to indicate the route and then have the input keys interpolate between them.

Thanks for the reply James. Finally got a bit of time to start looking at this again and I agree, I need to build a custom movement system.

Does anyone know of any examples where markers are used to define a path? I know in my head how it should all behave but as I mentioned, having no code background makes it very hard to know what nodes to even look for to start experimenting.

Following the advice of JamesG I started a new project from scratch and have managed to make a pawn that travels in the direction pushed on the game controller stick. When there is no input it returns to pointing up and slowly drifts down. Currently the movement is pawn relative but the rotation is still world relative as I haven’t figured out the maths to make it a local rotation yet which I will need once I can work out how to travel between markers placed in the world. Equally I need to work out how to add acceleration/deceleration to the movement. I also don’t have any collision working yet.

In the video you’ll see that the lighting cuts out at a certain height in the world and I’mnot sure why. The only light source is a directional light so I’m not sure what controls this. Any help would be greatly appreciated.

https://youtube.com/watch?v=mQm9KqVlMVQ

Tasks to work on for basic movement:

  • Have the Pawn move along an axis that is an average of the nearest markers in the world
  • When there is no directional input, have the pawn return to pointing upright as it currently does, but with a slow rotation, rather than an instant snap
  • Add collisions
  • Add acceleration/deceleration to the movement
  • Add a button input to provide a speed boost when held
  • Add some lag into the rotation speed so that it isn’t possible to instantly switch directions
  • Add some drift into the deceleration so that the pawn continues to move in its last direction until it stops (at which point the downward drift should kick in).

Reached a point an hour or so ago where I figured I should go to bed… so glad I didn’t :slight_smile:

I decided that before trying to get the pawn to travel on a path between points, that it would be a good idea if I could atleast control its path, and in the process sort out the rotation being pawn local rather than world relative and I’ve managed just that! :smiley:

In the video below you can see me flying about. The left stick always behaves screen relative, i.e. push left and you go to the left of the screen, push right and go right, likewise for up and down. The right stick turns the pawn and the camera to simulate being constrained to a path. Whilst these turn speeds are the same, they are not bound to each other so I can move the camera separately to the pawn if desired.

Hopefully with the setup I now have it will be relatively easy to swap out the right stick values for one derived from the placement of markers within the world, but that will have to wait for another day!

Has anyone used the new spline components in 4.3? If so would I be able to use it for defining the path that the player will be locked to in the world?

If that seems likely I’ll be re-subscribing to get the latest version. Thanks for any help with this :slight_smile:

The spline tool is actually more functional than their patch notes seem to suggest. I am playing around in the spline content examples and it is pretty sweet. They have lanterns swinging on a spline as if in the wind, a particle effect that follows a spline in a pattern, a plant that grows from almost nothing into a 6 foot long vine, and then they have a fish that you can swim and jump around the room and its body moves all fish like using splines.

From looking at the blueprints for those examples, I would have to say that you can make splines do just about anything you could think up for them. Still trying to wrap my head around the math and what each spline setting does.

Hey,

I’m searching now but can’t find the spline example content. Which project is it in?

If you downloaded the “Content Examples” project prior to version 4.3 being released, delete it and re-download it (unless there is a way to update it, not sure), there is new content added. To see the spline content, open the example content project and go to “File -> Open Level”, and choose the “Blueprint_Splines.umap” level.

Awesome, got it! Thank you :slight_smile:

I’d redownloaded but it hadn’t created the project in 4.3

https://youtube.com/watch?v=YAz9NV0vABE

Here is my latest progress. The movement is now all on the left stick and the world rotation is locked to the spline (you can see the path of the spline via the green lights on the ground plane). The snappy rotation is gone and the ‘character’ lerps to the new direction (movement speeds will no doubt get edited as time goes on). The character self rights to point upwards when no input is received and a gentle gravity kicks in. The spline loops! :slight_smile: so you can go back and forth at will.

Feels great running on a touch screen as well :smiley: (Galaxy Note II)

For those interested I’ve documented some of the techniques I’ve used in a tutorial here - https://forums.unrealengine.com/showthread.php?24522-Tutorial-Blueprint-Spline-locked-sidescroller-(e-g-Klonoa-Pandemonium-style-game)

Hi guys! I implemented this technique for my game, but I can’t get the results I am looking for.

Here is the spline I have (currently only for testing)

And here’s the Blueprint for the rotation function.

I tried logging the output of Get Rotation at Distance Along Spline and it is the same no matter of the distance. What is wrong with this?