x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Equation need to keep constant speed over timeline spline (regardless of spline length)

Heyo! So I am making a sprite follow a terrain 2d spline. The spline can be various lengths based on the level design. Being that timelines are distance covered based on time allotted, how can I make it so that no matter how long the spline is the object moving along the spline will always move at a set speed? I am sure there is an equation for it but I cant find one. Thanks in advance.

Product Version: UE 4.22
Tags:
more ▼

asked Apr 21 '19 at 06:34 AM in Blueprint Scripting

avatar image

Rotlaust
94 8 7 12

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

set the timeline to run 0-1. multiply timeline value by the spline length.

more ▼

answered Apr 21 '19 at 07:51 AM

avatar image

IndieGameCove
1.4k 11 4 10

avatar image Rotlaust Apr 21 '19 at 10:18 PM

Thanks for the reply! The method you suggest is what I am currently doing (as seen in the screen shot). However, that makes it so the object moving along the spline will move at a velocity based on the distance it needs to move over a set time. What I am wanting to do is have the object always move at a constant X velocity no matter how long that spline is. Meaning if my spline length is 1000 units, the object moves at 10 units per second. If the spline is 50 units in length then the object moves at 10 units per second. Would I have to modify the time in the timeline based on the objects variable speed, or can I still manipulate the objects speed even though the timeline length is set to 10 seconds?

alt text

avatar image IndieGameCove Apr 21 '19 at 11:21 PM

ah, once you add a timeline a variable for it is automatically created if you drag a line off the variable you have an option to set the play rate.

alt text

avatar image IndieGameCove Apr 21 '19 at 11:31 PM

i guess dividing the rate by the length works too. for some reason I was thinking multiplying should be separate and took the screen shot before testing without it.

avatar image Rotlaust Apr 21 '19 at 11:53 PM

This is exactly what I was looking for. Thanks a ton, man!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question