I’ve asked this question else where before, but no one quite got what I was asking, so I’m hoping someone could assist me here. I’m creating a third person on-rails shooter… sort of like a Star Fox game, so I’ve been wondering if it is possible to animate the camera’s forward movement so I can get an on-rails scripted type function for the camera, and then I can control the characters left, right, up, down movement separately in real time? I’ve been trying to figure this out because I’m new to UE4, and not very versed with camera and player control features. If this is one of the ways, or if there is another way please let me know, I’d appreciate it.
-Move the camera as well as the player along a spline.
-Upon input, offset the player from his original orbit.
Move the player along spline component tutorial
It’s just an interpolation on keyframe vector locations after all
I’m having an issue when I play the build the player character isn’t at the proper size in-game. How would I fix this? Also I can’t to find “Get World Location at Distance along Spline” node.
I think I found it, but instead of “Get World Location at Distance along Spline” its “Get Location at Distance along Spline”, and I’m pretty sure you select “world” under coordinate space. Only thing is is that I think you might have to activate it some, and I’m not sure which node to use.
Ok, I got it to work… well sorta. I did get many errors, although I’m almost certain they are all related to the nodes I circled here
since they they don’t necessarily have any function for this particular task. I know how to move a player on a typical 3D plane where its just forward, back, left, right, and the directions inbetween, but my knowledge in programming player inputs, and programming in general is limited. You said “Upon input, offset the player from his original orbit”, I’m not quite sure how to do that, but I’m guessing I have to use different input nodes aside from the ones I’m using now.
Remove these circled nodes along with the add movement input nodes, they are not needed. Also, instead of adding just a constant 10 to the spline distance every time, multiply a number (how much to move each frame) by delta seconds as well.
By offset I mean, store the spline location and rotation at distance on a vector variable and then based on the player’s current input (see Input Docs), calculate the desired position of the player relative to the previous stored vector. If you add these vectors together, you’ve got yourself an actual offset (such node as add offset exists, I believe but it’s kindof limiting and requires a different approach).
Sample offset walkthrough (not exactly your case, but can give you a little insight): The root component is moving linearly towards the player but the mesh (bolt) component of the actor is being offset on a random orbit every time in order to get that effect:
Youtube link
I followed the spline tutorial, and apparently add movement input was included in the algorithm, so I assume its necessary, but if isn’t needed then how is it possible to read input from the player? For example, you said store location and rotation on a vector, so you mean like get forward vector, or get right vector, right? So that when the player inputs something, then they will offset accordingly. I kinda get where your going with it, but I still don’t quite know how to do it. Another thing too, is it possible to increase the speed you move across the spline at different points. As the gameplay will begin to speed up as the level progresses, so this is going to be a important thing I’m going to need to know as well.
Take a look at this.
Remember , location and rotation are vectors. If you add to the spline’s location and rotation vectors, an extra offset vector you can move the player relative to the spine every tick.
The way to go in order to calculate these extra offset vectors would be to listen to the input events (MoveRight, MoveUp, Look Up, Look Right) and given the axis and delta second value, increment or decrement specific properties (X,Y,Z or Pitch Yaw Roll respectively).
In order to make the player have a variable speed (let’s say , uphill road) you need to add a multiplier where you get the next spline location (deltaseconds * rangepersecond * multiplier) (if that makes sense). You then need to calculate the value of this multiplier ε (0,+infinity) based on the current location (or the previous spline point) and the next spline point. For example, for each unit of height difference decrease speed of 0.01 uu. A good practise would be to also constantly recalculate a new “target” multiplier and interpolate the old one to the new one in order to get smooth motion.