Announcement

Collapse
No announcement yet.

[TUTORIAL] Create a procedural spline road tool in blueprints 4 part video series

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Hi ,great work. I myself want to use splines for a movement proplem.
    So i have a question about the implementation of splines:

    I want to move my character while he is standing on a moving walkway like you find them in a airport.
    The moving walkway should have a curved form sitting on a circle or donut.
    I need to apply a force which moves the character in every second tangential to the circle the moving walkway follows.

    Here comes the spline into play (at least i hope it can come into play here).
    I want to place a spline in the form of the circle in, or over the moving walkway so that it follows its form exactly and want to read out the tangential vectorcomponent of the spline to apply the force of the moving walkway in each point.
    From what i have watched so far you only can access the location information of the spline on each point of the spline ?
    Is that true or is there also a way to get the location information of the spline also between its points ?
    I need some trace blueprint which traces the spline while the character/player is moving above the spline and acceses its tangential vector very frequent to apply force in this direction.

    Has anyone a idea how i can do that ?

    Leave a comment:


  • replied
    That's great, I was contemplating doing something like this, but glad someone else did it already, hehe.

    It would be cool if this could be used to make a full fledged road tool that supports branching for streets and intersections. Actually I myself need a railroad tool more than roads but I guess the principles are the same...

    Leave a comment:


  • replied
    Originally posted by Denny View Post
    I really hope Epic accepts your pull request. This is too good to deny. I'm also too lazy to get involved with Visual Studio to build this.
    Hear hear.

    +1

    Leave a comment:


  • replied
    I really hope Epic accepts your pull request. This is too good to deny. I'm also too lazy to get involved with Visual Studio to build this.

    Leave a comment:


  • replied
    Here we go:



    Source code + blueprint diagrams: http://www.spaceduststudios.com/publ...mponent1.0.zip (2.5MB)

    This is a C++ engine extension of UE4's built-in SplineComponent and SplineComponentVisualizer, with additional support for arbitrary rotation (eg. twisting, looping) and width/scale at each spline point.

    Look for the "// BEGIN SDS" and "// END SDS" markers in the C++ code to see what I've added.

    At some point I'll get around to cleaning this up and submitting a pull request to the engine mainline, but for now here it is to play around with - get your hands dirty!

    I'd recommend watching dokipen's tutorials as you'll want to implement a similar road spline blueprint class, replacing SplineComponent with RoadSplineComponent.

    I've included my own blueprint class construction script for reference as a PNG in the ZIP. Use this to create roads that fit along the road spline. You'll need to set up your Tiles array with static meshes for different road tiles, and populate your Tile Indices array to specify which mesh each road segment should use.

    BP_RoadSplineActor variables (and sensible defaults):
    Spacing: 2000. Distance in world units along spline between each road track segment. Each segment is one SplineMeshComponent instance.
    Tangent scale: 2000. Changes how the road will be deformed between spline points. Generally you always want this to equal Spacing for best results.
    TrackWidthScale: 0.002. Scalar to align static mesh widths with the spline width.
    Create Segments: Boolean to toggle the spline meshes on/off.

    Spline editing controls:
    Same as SplineComponent, except the rotation + scale gizmos work.
    Hold Alt to drag out a new spline point.
    Scaling the X axis controls the tangent.
    Scaling the Y/Z axes controls the spline width.
    Last edited by sds-michael; 12-15-2016, 11:58 PM.

    Leave a comment:


  • replied
    Will do - I'll post the code tomorrow for everyone to play with, just got it submitted in our local code repository today. Unfortunately it requires some C++ engine changes, otherwise I'd release it as a plugin.

    Our team is going to spend the next few weeks trying it out as a whiteboxing tool for rapid track prototyping/iteration on Space Dust Racing, and I'm going to extend the idea further by allowing you to specify a static mesh for every SplineMeshComponent segment on the spline. If it works as I'm hoping it will, we can create a set of 3D road tiles, then build the majority of our tracks using this tool to stretch them into shape. We'll still have custom geometry in parts for set pieces/terrain etc., but this should take a lot of the pain away for the artists!

    Leave a comment:


  • replied
    Originally posted by sds-michael View Post
    Thanks a lot for this tutorial dokipen. I've taken the basic idea and extended it in 4.5 to support splines with knowledge of their orientation and width, so you can rotate/twist tracks and there are also no gimbal lock issues due to using world Up to calculate rotations etc:

    Width support:


    Rotation support using quaternions (so there's no gimbal lock issues) - corkscrew:


    Rotation support using quaternions (so there's no gimbal lock issues) - loop:


    Unfortunately this change has required some low-level engine modifications so it's not a blueprint-only solution. Happy to post the code though if anyone is interested... give me a few days to clean it up though!
    Dude this is awesome, when you get a chance please post how you achieved it.

    Leave a comment:


  • replied
    sds-michael: Click image for larger version

Name:	dOJt6XZlQw8qQ.gif
Views:	1
Size:	333.4 KB
ID:	1060128

    Leave a comment:


  • replied
    Wow greate stuff sds-michael. Yeah would be great to see code.

    Leave a comment:


  • replied
    Thanks a lot for this tutorial dokipen. I've taken the basic idea and extended it in 4.5 to support splines with knowledge of their orientation and width, so you can rotate/twist tracks and there are also no gimbal lock issues due to using world Up to calculate rotations etc:

    Width support:


    Rotation support using quaternions (so there's no gimbal lock issues) - corkscrew:


    Rotation support using quaternions (so there's no gimbal lock issues) - loop:


    Unfortunately this change has required some low-level engine modifications so it's not a blueprint-only solution. Happy to post the code though if anyone is interested... give me a few days to clean it up though!
    Last edited by sds-michael; 12-15-2016, 11:56 PM.

    Leave a comment:


  • replied
    Hey dokipen, do you know what the Spline Mesh change in 4.4 refers to?

    New: Added BP-callable accessors for spline mesh component values.
    It sounds like something that could be useful, but I don't see anything new in the context menu.

    Leave a comment:


  • replied
    Thanks again dokipen! Got the rivers procedurally generating all over the map finally.

    Leave a comment:


  • replied
    Originally posted by sarchasm View Post
    Love the tutorial, really took me far. My one problem I'm having is rotating the vertex, specifically on the Z axis. X and Y they seem to work (might need to figure out a way to add more segments on curves but thats another story). When I use the rotation tool and use the Z axis it has either no effect or gets completely disfigured. I'll have to investigate more.
    Are you talking about rotating the tangents on the curve in Z? I don't think that would work as you are spinning an vector around the way it's pointing. Hard to explain but basically the vector still ends up pointing in the same direction and doesn't effect the direction.

    If you want to rotate something that is places along the curve, then there is an attribute on the spline mesh component for the roll (one at each end so you could get some twisty effect going on). Or for static mesh component, you could rotate it around the curve direction/tangent.

    Leave a comment:


  • replied
    Love the tutorial, really took me far. My one problem I'm having is rotating the vertex, specifically on the Z axis. X and Y they seem to work (might need to figure out a way to add more segments on curves but thats another story). When I use the rotation tool and use the Z axis it has either no effect or gets completely disfigured. I'll have to investigate more.

    Leave a comment:


  • replied
    That was it, thanks for the help!

    I posted a thread in the feedback about what I feel are areas that need improvement regarding the spline tool: https://forums.unrealengine.com/show...l-improvements

    What do you think?

    Leave a comment:

Working...
X