• News

• Industries

• Learning & Support

• Community

• Marketplace

# Spline Troubles

Hi all,

I’m a student trying to get some experience working with ue4 (specifically blueprint). As a pet project, I started working on a gun that shoots rockets along a variable curve. The basic idea is that a ‘ghost’ bullet gets sent out when fire is pressed, which draws a 3-point spline based on player location, player direction, and the bullet location. Then, when the fire button is released, a rocket travels at a fixed speed along the spline, continuing outward in the tangent direction of the final point.

What I would like to do is approximate a parabola (treating the middle point as the vertex) by ‘scaling’ the control points appropriately.* However, I can’t find any information about scaling control points on a spline inside of blueprint. Also, I don’t know what formula unreal 4 uses for its splines, which makes it hard to even do an approximation. *

If anyone has any kind of information that might help, I’d really appreciate it.

E: I should also mention that I have considered approaching this without the use of splines. Unfortunately there are some very technical math-related problems that come about. In particular, finding a constant-speed paramaterization for the rocket to travel along is very involved.

I have seen very few spline related tutorials, though I haven’t exactly looked for one in awhile.

It may not strictly apply to your case but you may be able to pull some tidbits from it. I think figuring out the math part to match a parabola will be the hard part. This tutorial should at least get you going with spline control.

I actually used that video as a guide to make what I already have. I do the same spline-partitioning thing as the road example. The difference is that I have to update the positions of my splinemeshes every frame after the spline points get moved. I also have to add/remove splinemeshes based on changes in the splines length. Its all very similar though.

Unfortunately, this doesn’t really help me all that much. Really I just need some way of scaling those control points on my spline. Otherwise the ‘sharpness’ of the arc gets larger and larger as the spline grows (I can’t make the tangents scale proportionately to the spline’s length).

I know you said you want 3 points, but have you tried adding a few more points in there to smooth it out? Maybe that would help the tangents cope with the changes.