To make this work you'd have to change your code from using the last spline point to SplineComponent->GetSplineLength(). Otherwise the current implementation will not take into account that the first point is also the last.
For anyone that attempts this change just make sure the "Get Number Of Spline Points" doesn't have the subtraction node after it anymore. There's no need to subtract 1 since the first and last point aren't overlapping anymore.
@@pedrogomes693 actually when I removed the - 1 the spline object jerked into position every loop. When I added the - 1 back in the loop was smooth. But I still have "Closed Loop" checked. I also positioned my start/end spline points as the video instructed, just by matching the locations, which isn't hard at all.
To anyone who is having trouble. without seeing your blueprint graph I have no idea what is going wrong with your setup. Join the Discord in the video description and drop a screenshot in the "unreal" channel. there I will try to help you troubleshoot
Thank you so much for this easy to follow tutorial, I am working on a Shooting range for my test level, I had it setup that once the dummys were destroyed a door opens. With this I now have them setup to look more like a traditional Target Range.
Thanks! Perfect. For anyone having issues with the spline object not completing the loop, make sure in the timeline you are setting the values (0, 0) and (1, 1). Double check it isn't something like (0.5468, 1) somehow that happened to me.
Pro tip, connect the update execution pin to set actor location, otherwise it just looks weird when the actor sits there and spins. I literally sat there for like 5 minutes trying to understand what I did wrong before I re-watched the video and noticed I didn't have that execution pin set. Great tutorial! Subscribed.
Can I apply an effect to the actor when it's moving down the spline? For example, I want to make it invisible at the beginning of the spline and then make it visible again after 10 seconds? Is it possible with the example from the video?
This is very good. I put the spline inside the drone I was testing, so Actor, and GetActorLocation/Rotation, became Skeletal Mesh, SetWorldLocation/Rotation, and it works as it should. Thank you for a very clean tutorial. It takes a lot of trial and error to make a video game.
not sure if anybody knows how to do this, but im trying to only play my mesh along the spline 1 time, then update the location/rotation of the mesh to the final position/rotation. i can get the animation to work, but at the end of the animation my mesh jumps back to the start. btw, im animating everything from the sequence using a trigger for the bp.
Is anyone else having the problem where their actor is sperging out in one place? I have tried adjusting the instance editable variables to speed up or slow down the animations but this does nothing?
I'm not sure what would cause that problem. feel free to join the discord server linked below the video and send some screenshots of how you have things setup, maybe I can spot the issue that way.
Should be able to yeah, i haven't tested it out but in theory you should be able to animate it in the sequencer and have it still work. it might do some weird things the placement though since animating it like that also changes the length
i'm not sure what you're looking for with that. you want to generate spline points on the same location as a mesh? or do you want to make a spline that follows the shape of a mesh? because the latter is one of those things that sounds pretty easy to do for a human but telling a computer how to do it would be a massive pain and probably not great for performance if youre doing it in real time.
any object in the world is an actor so as long as your object variable is an actor variable, that can't be the issue. if the actor isn't moving when you run the game (it wont move when the game is not playing) and you're 100% sure the blueprints match maybe the speed variable is set to 0?
Amazing, thank you! I still got a question; How can I change the speed over time? At the beginning I want to make my object move kind of slow, while I want it to move pretty fast in during the end.
Great tutorial, really thorough. I did run into a slight issue I can't seem to resolve. My actor's rotation is running sideways along the spline is there a way to adjust the rotation of the actor so that the "front" is pointing in the direction of the spline movement? thank you!
Your actors mesh local rotation is probably facing the wrong direction, you could try to change it in that actors blueprint, if it happens with ALL your actors, you can just add 90 degrees to the Z rotation with a vector+ vector node
anyone know how to animate spline element count in the level sequencer?? theres no add keyframe button next to it and the splineelementcount is nowhere to be found in the sequence editor
I'm not sure that'd be possible. you could potentially try to make an event in the blueprint that adds one and calling that through the sequencer instead.
I learned a lot, thanks. Next step: to find how to make the player character go along a spline. If I choose that actor with this it gets really unhappy.
Did u find how to do it? Im traying the same but with not success, I change the Actor variable to get the pawn, it snpme into the start of the spine but then it doesnt move :(
I have a question about this method. If you don't close loop the spline, will the actor respawn at the starting point of the spline after reaching the end point of the spline? or will the whole thing not work
yup you got it right! if you dont close the spline it will just travel to the end and then teleport back to the start! (important to note that it doesn't respawn really, it just teleports so it's still the same instance, not a new one. for the most part that wont matter but if you're doing something with an actor that has ammo or something, keep that in mind)
@@thegamedevcave Great, I tried this and it worked perfectly. My only other question is that, this works in Play mode, but not in realtime mode when editing, is it possible to make it move in realtime mode as well? similar to clouds and trees and stuff. my end goal is to create sequence animation from this moving object.
@@armannasr3681 no, because this works on tick, it only runs during actual gameplay, not just in the viewport, moving trees and clouds are shader effects, which is why they work outside play mode in the viewport too. you can however put this blueprint into the sequencer and instead of using the math in event tick to set it's position, simply animate the position via exposed variable in the sequencer, that might take a few changes to the blueprint though.
@@thegamedevcave Thanks for response. I have done this with attaching actor to camera rig in the sequencer, but your method is much easier to do for multiple objects. Do you mind elaborating on how to animate the position with variable in sequencer? Thanks In advance.
Hello, good video. But I have a problem, I followed all the steps but once I place an actor into the spline line it moves the way the path was drawn but outside the actual path. Did I do something wrong with the actor location? I don't really know how to fix it.
it's most likely because the pivot point of your mesh is in a weird place. you can test that by just putting the mesh in a level and trying to rotate it. does it rotate around a weird place instead of around itself? if so , that's the issue. I dont know where you got your mesh from of course but in blender you can change it around in a couple of different ways.
Hi, great tutorial! Is it possible to have the animation start from a sequencer trigger? I've been trying to get an object to move along a spline for a cinematic sequence but I can't seem to make it work. UPDATE: I did make it work, but it only works if I hit play, which is still not the best solution. Is there any way to make this technique work or should I look for something else? Thanks.
you can start custom events from the sequence so if you hook this system up into a custom event instead of begin play that should do the trick. though i'm not 100% sure you can make objects move over a spline like that in the viewport when the game itself isn't running so you might be better off just animating the position of the object instead of trying to work with this spline system inside a cinematic like that.
thank you for the tutorial if my actor has animations, etc (tank from vigilante content), is it possible to make it act like it is driving realistically by this spline?
I made an updated tutorial that allows for multiple actors on a spline with an offset between each one recently you can check that out here : ruclips.net/video/I7vg-WXBtXY/видео.html
I noticed you reply to all of your comments, and I am hoping that's still the case haha. I am running into an issue, when I "destroy" the actor that's assigned to the spline path, I get errors. It seems the spline blueprint is trying to grab the destroyed actor that is no longer in play. Is there a way to cancel the timeline if it can't access the actor? Thank you.
use the IsValid node (the macro one, comes up as a question mark icon in the list i believe) it should have 2 outputs, one for when a variable you put into it is valid and one for if it's not valid. only run the code in the timeline update if the object is valid (dont do it before the timeline, if you do it before, it'll only check once and if you destroy the actor mid timeline you're still going to get errors)
the for loop still exists in unreal 5.1, it's one of the most basic functions of almost any programming language. try to check if you're following along with the tutorial properly or if you maybe missed a step somewhere. it's likely you're trying to add the loop in your construction script instead of the event graph. that is indeed not possible
Thanks for the tutorial. How could I add more actors to follow the same spline? All starting with different delay, but visible at the same time? Thanks.
to get that working you'd need to modify a fair few parts of this. changing the actor variable to an array, adding a float variable for the distance between every actor and then use a for each loop to move all the actors in the array around. there's probably a bit more to it but that's the basic idea to make it work with more actors :)
@@thegamedevcave would love to see this in blueprints. attempting a dark ride and would love all the "doombuggies" to be evenly spaced and moving along the same path
I have a train locomotive following a train track spline, I then added another train car to the same track spline, both are BP's, but the second train car starts at the exact same place as the first one, the locomotive. Obviously, I need the second car to be connected to the back of the locomotive and follow it around the track, which I simply cannot figure out how to do. Any help or suggestions? Thanks in advance.
you'll want to use an array instead of a single variable , then go through a for each loop with that array and use the index to multiply an offset value. it's a rather common question and bothersome to explain over just text so I intend to make a followup tutorial on just this topic sometimes the next couple of weeks.
@@borrowedtruths6955 if you need help faster than that feel free to join the discord server and when i'm around I'm happy to help you (especially with blueprint stuff, it's easier if you can send back and forth screenshots ;) )
@@thegamedevcave Can't seem to get into discord for some reason. I tried to reply to your email, but it said the address was not there. When you have the time, I could really use an image of the needed blueprint to make this work. Thanks again for your time.
@@borrowedtruths6955 i'm not sure what Email that would be? strange that you can't get into the discord though. i'm not sure how to help you with screenshots otherwise...
to start and stop you can simply add a bool variable and use a branch to only do all this when that bool is true, then setting the bool to true or false depending on your input , or whatever else you want will make it start and stop moving
you'll have to change a fair few things around to the point where it's a whole different setup. in short what you'd do is have you speed varaible * deltatime added to a float every tick. then use that float to find the new position along spline. then check if the float isn't larger than the spline length. if it is, reset it to 0. taht way they'll move based on speed instead of distance.
@@thegamedevcave Actually I think I solved it! I substituted the "1,0/Timeline Lenght" Part with a "Speed Variable/Get Spline Lenght" and in a few tests it always does what it is supposed to.
i think using a spline mesh instead of a static mesh should allow for that. i'm not super sure how exactly that works right at this moment though, it's been a while since ive done that
Nice tutorial thanks, I'm subscribe! One question, if i want to have more than one object like a train with some wagon's there is a way using these method?
you'd need to modify things a little, if you use an array instead of a single variable, you can set the position along the spline in a for each loop with a certain offset between every index of the loop, that will effectively create a train-like system.
i've been getting this question a lot lately, it's a bit more complicated to make that work so i'llt ry to make a followup tutorial when i can!! it'll take a little while most likely though, for now, in your event tick do all that you see in this tutorial in a for each loop instead with an object array instead of variable as it's input, at the nodes where you find position along spline at a certain length, add an offset value to the spline length there . multiplied my the array index(+1) , also check if that results in a number that's longer than the spline length, if so : subtract the spline length from this number so it loops properly. i know it's a bit hard to follow along with text, a followup video will come but not for a little while
Hello thanks for making this was looking for a updated tut on this and got my camera on there, However the big thing I can not figure out having been researching and experimenting all day, is how to have the object moving along the spline actually generate a overlap event? I have tried creating different triggers, objects/actor , making sure all or set to (overlap All) the trigger object and the object on (or you could say the component that is set to move along the spline.) But it will not trigger tried simulating and seeing if there is break, nothing continues running I just don't know. I even tried changing the component there to just a mesh, collision sphere, still no overlap event is triggered. If you have any suggestions I would be thankful. I am using a (Play animation function) that seems to work fine if I use a event to trigger, like onbegin play or something.
that's a good question. are you moving a component over a spline with both in the same blueprint? if so, it might be the case that the component wouldn't generate overlap events if the actor isn't moving or something (that shouldn't be the case but that's the best I can come up with without knowing al the ins and outs of the project of course). if that's the case, using a system like i do in this video where the object moving over the spline isn't just a component but a whole separate actor, might fix the issue. otherwise i'm not sure what the issue could be. for debugging purposes it's always a good idea to see if events trigger by putting in a print string before/instead of the actual node youre trying to use, as that way it's very easy to see if the event triggered, because if it does you know at least that part works and can then focus on finding the problem in a slightly narrower search. (though, by the sounds of it, it DOES sound like the event is just not triggering in this case indeed, still, always good to double check that)
@@thegamedevcave I will be redoing exactly as you did tonight when I get off work and experimenting more. Thanks for the response. If successful will leave update.
Oh and the project is just trying to do fly through and have animations trigger when the object passes through that section. Pretty much like those old hunted house rides I guess? if you want to see look here but may want to mute the audio. "avantegarde" www.twitch.tv/videos/1520859936
@@thegamedevcave Your pathing worked perfectly of course, the overlap issue I had turned out I was able to resolve by making the object that will be attached to spline path a Actor and giving it separate collision component that will deal with that interaction.
Do you think it is possible to interpolate physics (without spline) movement with spline movement at runtime? I hope I worded that clearly, thx in advance and for video!
probably not to be honest. the whole idea here is you're setting the position directly every frame instead of letting physics move it around. combining the 2 usually doesn't really go very well together. you'd have to program your own pseudo physics moment.
@@tarekwayne9193 something else i touvght of that might help you depending on your usecasse is only setting the X and Y positions and setting the Z position equal to GetActorLocation.Z . that way it won't get stuck to the spline in the up and down direction, so that would allow for gravity at least, but it will still follow the path in the 2 horizontal directions.
@@thegamedevcave I had something like that in mind also! I also wanted to try out the exact opposite, with the Z axis, precisely to keep the car glued to the track! Maybe turning the gravity off?
@@tarekwayne9193 I would say you for sure gotta turn the gravity off yeah. I'm not 100% sure on the math, i'd have to play around with it but what I think i'd do is whenever your player collides with a car, have the car check if it's being hit from the left or the right, and add or subtract to a float value. then use that float to add a horizontal offset to the left/ right from the spline. You probably could do that with getting the position along spline in local, then adding that float value to either the X or the Y value of that , and then converting that to global position to set your car to that. Otherwise you'll have to mess around with calculating it based on the spline's tangents and adding the offset to that perpendicular to the tangent (which is where I start to be unsure of how I would ACTUALLY implement that... but I think the calculating things in local space first would probably be possible and much easier anyway)
I will have to look into it, I plan on making a followup to this video soon where I add train tracks to this system, so maybe that will be helpful for what you need :)
Thanks for the tutorial! It works like a piece of cake :3 And I was wondering why setting timeline length doesnt affect speed of moving. Turned out I didn't connect Event Play with Set Play Rate nodes. Debugging is a thing
sure, instead of setting the rotation to the spline tangents you just replace that with another bit of script that sets a rotation at random at begin play and it'll have a random rotation. if you want it to move it's rotation randomly, that's a little more complex though. .
@@vmunozbe there are many ways to do something like that. the most straightforward way is to add some sort of offset and have each cart use a larger offset. you could make a more robust system for that but that would be a whole tutorial on itself
@@thegamedevcave ok cool thank you because im trying to create 3D text with holographic material rotating around a building using your spline Blueprint. So i like to alos thank you for that
there is a couple of ways you could do this, you could make an array and at begin play pick a random entry from the array to set as the actor to move over the spline. that way you can just add 10-20-30, etc different actors it can choose from. or you could use "get all actors of class" at begin play to make that array for you so it automatically picks one actor of a certain type at random (in the same way as i listed above, just pick a random index out of that array).
Do you know of any tutorial that shows how to do that? I'm a complete noob and I wouldn't know how to do it, but I would be able to follow along :) Thanks :)
all of this just to move a character along a spline??? Idk how anyone uses Unreal, it takes like 4 clicks in C4D to achieve the same exact thing. So unintuitive it hurts
I mean unreal is a game engine, that comes with way different expectations compared to 3D modeling or animation software. the whole idea is that any parameter in this can be influenced during runtime, where is in animation you're very carefully creating the 1 output you're looking for. simple example : let's say this is part of a boss fight where the boss is surrounded by turrets on a rail track and the turrets start to move faster as the boss loses HP to make the fight increase in difficulty. So yeah, it seems over complicated and in the end, you could probably get a pretty similar result with just throwing 2 keyframes onto a timeline and calling it a day (still a couple more clicks compared to C4D i'm guessing though) but it's a hard comparison to make.
@@thegamedevcave Yeah very true, I can understand that. Either way great tutorial and thanks for the help, just been a tough transition to another 3D program lol
@@TheHumanAnonymous i totally get that, moving from blender into unreal was super overwhelming to me too. i'm not sure how deep in the learning process you are at this point but i also have a 6 part series going over some of the basics that might be helpful. ruclips.net/p/PLoReGgpfex3x1Tmkru1QyTB0pXiWASj5M as for rotation, the simplest way would probably be to just add a vector3 value to your characters rotation at the very end of the event graph , that way you can add X,Y,Z rotation to your actor after it's been lined up with the spline
well the issue will be somewhere else in the blueprint graph then. without seeing it, it's pretty hard to tell where the mistake is though. feel free to drop a screenshot in the discord server and i'll try to have a look at it if you haven''t found a fix yet.
@@thegamedevcave I found it ... When setting up the Timeline, I'm sure I set points 0,0 and 1,1 - however checking back didn't saved exactly these 2 points, had to fix it again. Can't comprehend how it could happen this, for UE4 & UE5 I recreated these scripts and in all cases wasn't the 0,0 - 1,1 point pairs in the Timeline. Worth to keep in mind this thing with timelines ... might not save what they are given initially.
I guess because it’s not just for animation but making games so you’re working with real-time stuff. If you just want to make it animate over a spline manually about 80% isn’t needed
@@thegamedevcave you cut sooooo much in video edit stage, to reproduce yours 1,5 min i spent 30 min to find buttons and menus. Im not happy to ask 100 questions to you.
Awesome post...and after having watched a few, this one was so easy to follow/replicate... Being a nood to Unreal I do have a question though: I followed all the steps yet when I press play or shift the timeline cursor, my model makes the 'kessel run' in like 1 second...clearly..I've done something wrong...can anyone please help me to fix this issue? Thanks in advance and huge thank you to the Game Dev Cave for this post.
assuming all your nodes are the same as mine, you made a float variable that is used to set the timeline's duration. you can edit that variable on the instance you put in your level (assuming you followed along and made it public) It's very likely you have that set at 1, meaning it'll make the whole loop in 1 second.
instead of trying to position and rotate your last spline point just select the "Closed Loop" property on the spline component
my god this is great! no idea how I overlooked that but I'm pinning this comment so everyone can see!
To make this work you'd have to change your code from using the last spline point to SplineComponent->GetSplineLength(). Otherwise the current implementation will not take into account that the first point is also the last.
For anyone that attempts this change just make sure the "Get Number Of Spline Points" doesn't have the subtraction node after it anymore. There's no need to subtract 1 since the first and last point aren't overlapping anymore.
@@pedrogomes693 actually when I removed the - 1 the spline object jerked into position every loop. When I added the - 1 back in the loop was smooth. But I still have "Closed Loop" checked. I also positioned my start/end spline points as the video instructed, just by matching the locations, which isn't hard at all.
To anyone who is having trouble. without seeing your blueprint graph I have no idea what is going wrong with your setup. Join the Discord in the video description and drop a screenshot in the "unreal" channel. there I will try to help you troubleshoot
this is like watching a math guide i don't know what i'm doing but it's working
Simple, straight to the point, good speed. Fantastic tutorial mate, appreciate it.
Thank you so much for this easy to follow tutorial, I am working on a Shooting range for my test level, I had it setup that once the dummys were destroyed a door opens. With this I now have them setup to look more like a traditional Target Range.
Thanks!
Welcome!
Thanks! Perfect.
For anyone having issues with the spline object not completing the loop, make sure in the timeline you are setting the values (0, 0) and (1, 1). Double check it isn't something like (0.5468, 1) somehow that happened to me.
Pro tip, connect the update execution pin to set actor location, otherwise it just looks weird when the actor sits there and spins. I literally sat there for like 5 minutes trying to understand what I did wrong before I re-watched the video and noticed I didn't have that execution pin set. Great tutorial! Subscribed.
Can I apply an effect to the actor when it's moving down the spline? For example, I want to make it invisible at the beginning of the spline and then make it visible again after 10 seconds? Is it possible with the example from the video?
how do I make a mission where I chase the enemy along a pre-defined path, where the enemy jumps over obstacles and runs?
This is very good. I put the spline inside the drone I was testing, so Actor, and GetActorLocation/Rotation, became Skeletal Mesh, SetWorldLocation/Rotation, and it works as it should. Thank you for a very clean tutorial. It takes a lot of trial and error to make a video game.
very glad it was helpful!
Great video, Man! Thanks a lot!
In 1:22 you skip the node you type. I cant find this one. Can you say wich one it is?
that's the custom event I just made before that so what that node is called depends on what you call your custom event
Hi, if you want have a Timeline loop, you can use the node "Set Looping".
that's a much better way than what I do here, thanks for pointing it out!! xd
not sure if anybody knows how to do this, but im trying to only play my mesh along the spline 1 time, then update the location/rotation of the mesh to the final position/rotation. i can get the animation to work, but at the end of the animation my mesh jumps back to the start. btw, im animating everything from the sequence using a trigger for the bp.
I redid the tutorial but it doesn't work when I do play and on my time line I have (time line paused @ 0.00s 0.0%)
Is anyone else having the problem where their actor is sperging out in one place? I have tried adjusting the instance editable variables to speed up or slow down the animations but this does nothing?
I'm not sure what would cause that problem. feel free to join the discord server linked below the video and send some screenshots of how you have things setup, maybe I can spot the issue that way.
Is it possible to also have the spline move? For example, the spline slowly moves downward while the object follows the spline.
Should be able to yeah, i haven't tested it out but in theory you should be able to animate it in the sequencer and have it still work. it might do some weird things the placement though since animating it like that also changes the length
Is it possible to make it the other way around? Making a spline follow the object?
i'm not sure what you're looking for with that. you want to generate spline points on the same location as a mesh?
or do you want to make a spline that follows the shape of a mesh? because the latter is one of those things that sounds pretty easy to do for a human but telling a computer how to do it would be a massive pain and probably not great for performance if youre doing it in real time.
My actor does not move at all, checked multiple times if my blueprint is the same, maybe you can not choose "anything" as an actor at the end?
any object in the world is an actor so as long as your object variable is an actor variable, that can't be the issue. if the actor isn't moving when you run the game (it wont move when the game is not playing) and you're 100% sure the blueprints match maybe the speed variable is set to 0?
Amazing, thank you!
I still got a question; How can I change the speed over time? At the beginning I want to make my object move kind of slow, while I want it to move pretty fast in during the end.
Nevermind, I found out you can just adjust the curve in the "timeline" node, which makes it pretty accurate
Great tutorial, really thorough. I did run into a slight issue I can't seem to resolve. My actor's rotation is running sideways along the spline is there a way to adjust the rotation of the actor so that the "front" is pointing in the direction of the spline movement? thank you!
Your actors mesh local rotation is probably facing the wrong direction, you could try to change it in that actors blueprint, if it happens with ALL your actors, you can just add 90 degrees to the Z rotation with a vector+ vector node
@@thegamedevcave ok cool the idea i have is to try to create a 3D text with a holographic material rotating around a building.
anyone know how to animate spline element count in the level sequencer?? theres no add keyframe button next to it and the splineelementcount is nowhere to be found in the sequence editor
I'm not sure that'd be possible. you could potentially try to make an event in the blueprint that adds one and calling that through the sequencer instead.
I learned a lot, thanks. Next step: to find how to make the player character go along a spline. If I choose that actor with this it gets really unhappy.
Did u find how to do it? Im traying the same but with not success, I change the Actor variable to get the pawn, it snpme into the start of the spine but then it doesnt move :(
@@MECLOCO Yeah I got that too. Haven't got back to it since then :(
I have a question about this method. If you don't close loop the spline, will the actor respawn at the starting point of the spline after reaching the end point of the spline? or will the whole thing not work
yup you got it right! if you dont close the spline it will just travel to the end and then teleport back to the start! (important to note that it doesn't respawn really, it just teleports so it's still the same instance, not a new one. for the most part that wont matter but if you're doing something with an actor that has ammo or something, keep that in mind)
@@thegamedevcave Great, I tried this and it worked perfectly. My only other question is that, this works in Play mode, but not in realtime mode when editing, is it possible to make it move in realtime mode as well? similar to clouds and trees and stuff. my end goal is to create sequence animation from this moving object.
@@armannasr3681 no, because this works on tick, it only runs during actual gameplay, not just in the viewport, moving trees and clouds are shader effects, which is why they work outside play mode in the viewport too.
you can however put this blueprint into the sequencer and instead of using the math in event tick to set it's position, simply animate the position via exposed variable in the sequencer, that might take a few changes to the blueprint though.
@@thegamedevcave
Thanks for response. I have done this with attaching actor to camera rig in the sequencer, but your method is much easier to do for multiple objects. Do you mind elaborating on how to animate the position with variable in sequencer?
Thanks In advance.
Hello, good video. But I have a problem, I followed all the steps but once I place an actor into the spline line it moves the way the path was drawn but outside the actual path. Did I do something wrong with the actor location? I don't really know how to fix it.
it's most likely because the pivot point of your mesh is in a weird place. you can test that by just putting the mesh in a level and trying to rotate it. does it rotate around a weird place instead of around itself? if so , that's the issue. I dont know where you got your mesh from of course but in blender you can change it around in a couple of different ways.
Hi, great tutorial! Is it possible to have the animation start from a sequencer trigger? I've been trying to get an object to move along a spline for a cinematic sequence but I can't seem to make it work.
UPDATE: I did make it work, but it only works if I hit play, which is still not the best solution. Is there any way to make this technique work or should I look for something else? Thanks.
you can start custom events from the sequence so if you hook this system up into a custom event instead of begin play that should do the trick. though i'm not 100% sure you can make objects move over a spline like that in the viewport when the game itself isn't running so you might be better off just animating the position of the object instead of trying to work with this spline system inside a cinematic like that.
thank you for the tutorial
if my actor has animations, etc (tank from vigilante content), is it possible to make it act like it is driving realistically by this spline?
sure your actor can do anything it usually would, including animations while it's moving along the spline
why does the object jerk up and down when moving along a straight spline?
you probably have gravity enabled in the physyics settings
@@thegamedevcave Thanks ... I had "Simulate Physics" enabled on actor
Thanks for the tutorial. How can I add more than one object to spline and they have different starting points ? I want to make esclator with that
I made an updated tutorial that allows for multiple actors on a spline with an offset between each one recently you can check that out here : ruclips.net/video/I7vg-WXBtXY/видео.html
I noticed you reply to all of your comments, and I am hoping that's still the case haha.
I am running into an issue, when I "destroy" the actor that's assigned to the spline path, I get errors. It seems the spline blueprint is trying to grab the destroyed actor that is no longer in play. Is there a way to cancel the timeline if it can't access the actor?
Thank you.
use the IsValid node (the macro one, comes up as a question mark icon in the list i believe) it should have 2 outputs, one for when a variable you put into it is valid and one for if it's not valid. only run the code in the timeline update if the object is valid (dont do it before the timeline, if you do it before, it'll only check once and if you destroy the actor mid timeline you're still going to get errors)
@@thegamedevcave This Just saved me, Thanks !!!
go to were loop node is at and it dosent exist in my engon layout sadly for 5.1
the for loop still exists in unreal 5.1, it's one of the most basic functions of almost any programming language. try to check if you're following along with the tutorial properly or if you maybe missed a step somewhere. it's likely you're trying to add the loop in your construction script instead of the event graph. that is indeed not possible
Thanks for the tutorial. How could I add more actors to follow the same spline? All starting with different delay, but visible at the same time? Thanks.
to get that working you'd need to modify a fair few parts of this. changing the actor variable to an array, adding a float variable for the distance between every actor and then use a for each loop to move all the actors in the array around. there's probably a bit more to it but that's the basic idea to make it work with more actors :)
@@thegamedevcave would love to see this in blueprints. attempting a dark ride and would love all the "doombuggies" to be evenly spaced and moving along the same path
I have a train locomotive following a train track spline, I then added another train car to the same track spline, both are BP's, but the second train car starts at the exact same place as the first one, the locomotive. Obviously, I need the second car to be connected to the back of the locomotive and follow it around the track, which I simply cannot figure out how to do.
Any help or suggestions?
Thanks in advance.
you'll want to use an array instead of a single variable , then go through a for each loop with that array and use the index to multiply an offset value. it's a rather common question and bothersome to explain over just text so I intend to make a followup tutorial on just this topic sometimes the next couple of weeks.
@@thegamedevcave Thanks, I really appreciate it. You just earned a new subscriber.
@@borrowedtruths6955 if you need help faster than that feel free to join the discord server and when i'm around I'm happy to help you (especially with blueprint stuff, it's easier if you can send back and forth screenshots ;) )
@@thegamedevcave Can't seem to get into discord for some reason. I tried to reply to your email, but it said the address was not there. When you have the time, I could really use an image of the needed blueprint to make this work. Thanks again for your time.
@@borrowedtruths6955 i'm not sure what Email that would be? strange that you can't get into the discord though. i'm not sure how to help you with screenshots otherwise...
Thanks for the tutorial. How can I pause the movement with a Keybind during gameplay and also resume ?
to start and stop you can simply add a bool variable and use a branch to only do all this when that bool is true, then setting the bool to true or false depending on your input , or whatever else you want will make it start and stop moving
what if you wanted it to move without hitting play- sort of like how fire works from the stater particle pack
I dont think you'll be able to move objects around like that before beginplay
Thank you, very helpful tutorial. Is it possible to make an actor move at a fixed speed regardless of spline lenght?
you'll have to change a fair few things around to the point where it's a whole different setup.
in short what you'd do is have you speed varaible * deltatime added to a float every tick. then use that float to find the new position along spline. then check if the float isn't larger than the spline length. if it is, reset it to 0. taht way they'll move based on speed instead of distance.
@@thegamedevcave Thanks a lot for the fast answer. I'm not sure if I can do this with my limited knowledge, though.
@@thegamedevcave Actually I think I solved it! I substituted the "1,0/Timeline Lenght" Part with a "Speed Variable/Get Spline Lenght" and in a few tests it always does what it is supposed to.
Good tutorial! But can you help to add deformation of the model while moving along the spline?
i think using a spline mesh instead of a static mesh should allow for that. i'm not super sure how exactly that works right at this moment though, it's been a while since ive done that
@@thegamedevcave
Thanks! I'll try this)
Nice tutorial thanks, I'm subscribe! One question, if i want to have more than one object like a train with some wagon's there is a way using these method?
you'd need to modify things a little, if you use an array instead of a single variable, you can set the position along the spline in a for each loop with a certain offset between every index of the loop, that will effectively create a train-like system.
@@thegamedevcave Thank's i will follow that tip.
How do you set another object to follow the first? Or a complete circle of evenly spaced couches? (thinking the track of Disney's Haunted Mansion)
i've been getting this question a lot lately, it's a bit more complicated to make that work so i'llt ry to make a followup tutorial when i can!! it'll take a little while most likely though, for now, in your event tick do all that you see in this tutorial in a for each loop instead with an object array instead of variable as it's input, at the nodes where you find position along spline at a certain length, add an offset value to the spline length there . multiplied my the array index(+1) , also check if that results in a number that's longer than the spline length, if so : subtract the spline length from this number so it loops properly.
i know it's a bit hard to follow along with text, a followup video will come but not for a little while
@@thegamedevcave I think I found a solution. Could I message it to you somehow?
i'm glad you managed to make it work. you're always free to join the discord server linked below in the description to share your findings :)
Hello thanks for making this was looking for a updated tut on this and got my camera on there, However the big thing I can not figure out having been researching and experimenting all day, is how to have the object moving along the spline actually generate a overlap event? I have tried creating different triggers, objects/actor , making sure all or set to (overlap All) the trigger object and the object on (or you could say the component that is set to move along the spline.) But it will not trigger tried simulating and seeing if there is break, nothing continues running I just don't know. I even tried changing the component there to just a mesh, collision sphere, still no overlap event is triggered. If you have any suggestions I would be thankful. I am using a (Play animation function) that seems to work fine if I use a event to trigger, like onbegin play or something.
that's a good question. are you moving a component over a spline with both in the same blueprint? if so, it might be the case that the component wouldn't generate overlap events if the actor isn't moving or something (that shouldn't be the case but that's the best I can come up with without knowing al the ins and outs of the project of course).
if that's the case, using a system like i do in this video where the object moving over the spline isn't just a component but a whole separate actor, might fix the issue. otherwise i'm not sure what the issue could be.
for debugging purposes it's always a good idea to see if events trigger by putting in a print string before/instead of the actual node youre trying to use, as that way it's very easy to see if the event triggered, because if it does you know at least that part works and can then focus on finding the problem in a slightly narrower search. (though, by the sounds of it, it DOES sound like the event is just not triggering in this case indeed, still, always good to double check that)
@@thegamedevcave I will be redoing exactly as you did tonight when I get off work and experimenting more. Thanks for the response. If successful will leave update.
Oh and the project is just trying to do fly through and have animations trigger when the object passes through that section. Pretty much like those old hunted house rides I guess? if you want to see look here but may want to mute the audio. "avantegarde" www.twitch.tv/videos/1520859936
@@thegamedevcave Your pathing worked perfectly of course, the overlap issue I had turned out I was able to resolve by making the object that will be attached to spline path a Actor and giving it separate collision component that will deal with that interaction.
@@mrgreatjob im glad you were able to figure it out!!
Do you think it is possible to interpolate physics (without spline) movement with spline movement at runtime? I hope I worded that clearly, thx in advance and for video!
probably not to be honest. the whole idea here is you're setting the position directly every frame instead of letting physics move it around. combining the 2 usually doesn't really go very well together. you'd have to program your own pseudo physics moment.
@@thegamedevcave thx for your swift response! Yh, the idea isn't very logical/practical!
@@tarekwayne9193 something else i touvght of that might help you depending on your usecasse is only setting the X and Y positions and setting the Z position equal to GetActorLocation.Z . that way it won't get stuck to the spline in the up and down direction, so that would allow for gravity at least, but it will still follow the path in the 2 horizontal directions.
@@thegamedevcave I had something like that in mind also! I also wanted to try out the exact opposite, with the Z axis, precisely to keep the car glued to the track!
Maybe turning the gravity off?
@@tarekwayne9193 I would say you for sure gotta turn the gravity off yeah. I'm not 100% sure on the math, i'd have to play around with it but what I think i'd do is whenever your player collides with a car, have the car check if it's being hit from the left or the right, and add or subtract to a float value. then use that float to add a horizontal offset to the left/ right from the spline.
You probably could do that with getting the position along spline in local, then adding that float value to either the X or the Y value of that , and then converting that to global position to set your car to that.
Otherwise you'll have to mess around with calculating it based on the spline's tangents and adding the offset to that perpendicular to the tangent (which is where I start to be unsure of how I would ACTUALLY implement that... but I think the calculating things in local space first would probably be possible and much easier anyway)
Yestarday I see tutorial about paint on skeleton mesh using render target, you thing its possible the same thing on spline mesh?
I am not sure but I assume it should be!
But how take UV texture from all spline and save it to square 2048x2048? Any idea maybe you make tutorial for this
I will have to look into it, I plan on making a followup to this video soon where I add train tracks to this system, so maybe that will be helpful for what you need :)
Thanks for the tutorial! It works like a piece of cake :3 And I was wondering why setting timeline length doesnt affect speed of moving. Turned out I didn't connect Event Play with Set Play Rate nodes. Debugging is a thing
it's easy to overlook simple things! glad you figured it out :)
There is a way to make the object to rotate randomly?
sure, instead of setting the rotation to the spline tangents you just replace that with another bit of script that sets a rotation at random at begin play and it'll have a random rotation. if you want it to move it's rotation randomly, that's a little more complex though. .
@@thegamedevcave thanks for the reply
Great video. Can this also be used to move trains along the track?
That’s exactly the kind of thing this is useful for!! :)
@@thegamedevcave tnx for the video. I´m trying to do exactly the same but for a train. How I add more wagons? any help??
@@vmunozbe there are many ways to do something like that. the most straightforward way is to add some sort of offset and have each cart use a larger offset. you could make a more robust system for that but that would be a whole tutorial on itself
Great straight to the point tutorial
Thanks!!
This one earned you a sub. Thanks for the coherent content
thanks! Hope I can be helpful going forward!
Nice great tutorial and I never knew about this so good to know now.
Glad I could help, it's useful stuff!
How would you apply this to 3D text 🤔🙏✌️
your 2D text should function the same as any actor I think so this should work without any major modifications to the script.
@@thegamedevcave ok cool thank you because im trying to create 3D text with holographic material rotating around a building using your spline Blueprint. So i like to alos thank you for that
Thank you so much for this!
Thanks, i enjoyed to listen and learn from video! :)
Brilliant Tutorial.
Great tutorial thanks a lot for this! :) Would it be possible to have random objects move along the same spline? If yes how would you do it? Cheers :)
there is a couple of ways you could do this, you could make an array and at begin play pick a random entry from the array to set as the actor to move over the spline. that way you can just add 10-20-30, etc different actors it can choose from.
or you could use "get all actors of class" at begin play to make that array for you so it automatically picks one actor of a certain type at random (in the same way as i listed above, just pick a random index out of that array).
Amazing thanks a lot! :)
Do you know of any tutorial that shows how to do that? I'm a complete noob and I wouldn't know how to do it, but I would be able to follow along :) Thanks :)
@@henrycooper8486 i'm not sure but i'll try to make a short tutorial showing it later this week!
You are amazing thank you so much for this! It is greatly appreciated! :)
Thank you good sir, I subscribed.
Thanks for the sub!
super helpful thanks mate
Works like a charm
Happy it helped!
all of this just to move a character along a spline??? Idk how anyone uses Unreal, it takes like 4 clicks in C4D to achieve the same exact thing. So unintuitive it hurts
Nothing against the tutorial, just can't believe how over complicated it is to achieve such a simple task
I mean unreal is a game engine, that comes with way different expectations compared to 3D modeling or animation software. the whole idea is that any parameter in this can be influenced during runtime, where is in animation you're very carefully creating the 1 output you're looking for.
simple example : let's say this is part of a boss fight where the boss is surrounded by turrets on a rail track and the turrets start to move faster as the boss loses HP to make the fight increase in difficulty.
So yeah, it seems over complicated and in the end, you could probably get a pretty similar result with just throwing 2 keyframes onto a timeline and calling it a day (still a couple more clicks compared to C4D i'm guessing though) but it's a hard comparison to make.
@@thegamedevcave Yeah very true, I can understand that. Either way great tutorial and thanks for the help, just been a tough transition to another 3D program lol
@@thegamedevcave Is there an easy way to add banking/rotation to the character on the spline animation btw?
@@TheHumanAnonymous i totally get that, moving from blender into unreal was super overwhelming to me too. i'm not sure how deep in the learning process you are at this point but i also have a 6 part series going over some of the basics that might be helpful.
ruclips.net/p/PLoReGgpfex3x1Tmkru1QyTB0pXiWASj5M
as for rotation, the simplest way would probably be to just add a vector3 value to your characters rotation at the very end of the event graph , that way you can add X,Y,Z rotation to your actor after it's been lined up with the spline
You save my life. Genio, gracias
Doesn't works for me, at best moves to the first point. Yes, I did the Number of Spline Points - 1. I'm using the latest Unreal Engine 5.1
well the issue will be somewhere else in the blueprint graph then. without seeing it, it's pretty hard to tell where the mistake is though. feel free to drop a screenshot in the discord server and i'll try to have a look at it if you haven''t found a fix yet.
@@thegamedevcave I found it ... When setting up the Timeline, I'm sure I set points 0,0 and 1,1 - however checking back didn't saved exactly these 2 points, had to fix it again. Can't comprehend how it could happen this, for UE4 & UE5 I recreated these scripts and in all cases wasn't the 0,0 - 1,1 point pairs in the Timeline. Worth to keep in mind this thing with timelines ... might not save what they are given initially.
This is amazing! Thank you subbed!
Thanks for the sub!
Thanks a lot. but my character move so quick
make sure you set the variable for your timeline length (the float value) to a good number
awesome video thanks
Merci mon reuf je t'aimes
You could do this in a minute in blender and easier.
Why does Epic make things so complicated?.
I guess because it’s not just for animation but making games so you’re working with real-time stuff.
If you just want to make it animate over a spline manually about 80% isn’t needed
@@thegamedevcave Never the less, it should be easier and more intuitive to do.
They should copy how 3d apps like blender work.
extremally bad guide
Hey, maybe instead of just being rude and complain, you could ask for help if you are having trouble. Just a thought
@@thegamedevcave you cut sooooo much in video edit stage, to reproduce yours 1,5 min i spent 30 min to find buttons and menus. Im not happy to ask 100 questions to you.
@@orenders maybe learn the engine a bit more first on a basic level then, I have a full playlist that goes over the basics too
Awesome post...and after having watched a few, this one was so easy to follow/replicate...
Being a nood to Unreal I do have a question though: I followed all the steps yet when I press play or shift the timeline cursor, my model makes the 'kessel run' in like 1 second...clearly..I've done something wrong...can anyone please help me to fix this issue? Thanks in advance and huge thank you to the Game Dev Cave for this post.
assuming all your nodes are the same as mine, you made a float variable that is used to set the timeline's duration. you can edit that variable on the instance you put in your level (assuming you followed along and made it public) It's very likely you have that set at 1, meaning it'll make the whole loop in 1 second.
thank you for the tutorial!