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"

Cylinder race track

Hello. I want to make a game in which the player rotates along the inside of a cylinder and moves forward along its lenght. How can I make a blueprint for that, or what tutorial/s should i follow? A good example of what I want to do is a level in the old game Jak3 where you have to get back to the city. Thank you.

alt text

alt text

Product Version: UE 4.20
Tags:
plat-jak3-i006.jpg (109.0 kB)
iidea.png (312.6 kB)
more ▼

asked Oct 19 '18 at 12:21 PM in Blueprint Scripting

avatar image

Notyourphobia
1 1 2

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

2 answers: sort voted first

The cheap way: Use a SpringArm and attach your player, then rotate the SpringArm and move it along X or Y for forward/backward.

Or you code the math yourself, which is nothing more than 'Polar Coordinates'. You can have a value from 0-360 and if you press left/right you increase/decrease the value and with the help of the Polar Coordinates Formula you get your x and y values on the circle. Then again move it along X or Y for forward/backward.

Would be great to hear if this method worked out for you :)

more ▼

answered Oct 19 '18 at 12:38 PM

avatar image

Ninjin
4.1k 88 38 152

avatar image Notyourphobia Oct 19 '18 at 12:59 PM

Thnak you for your help. The main purpose of this project is learning so I dont want to use cheap tricks. How do I start coding the math by myself?I can't fiind anything related to polar coordinates in the blueprint editor, all possible actions.

avatar image Ninjin Oct 19 '18 at 02:07 PM

You are right, functions like FMath::PolarToCartesian (C++) are not exposed to Blueprint. However, Polar Coordinates is a math term, I really advice to google it and learn what it is. Once you understand what this math is doing, implementing those functions in BP should be easy.

avatar image Ninjin Oct 19 '18 at 02:16 PM

If this is not an Infinite Runner, you can also research 'spline component', where you create your tubes and use this spline component for the forward/backwards direction of the player. Offsetting the player from the spline is still Polar Coordinates.

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

If the car doesn't need to actually physics-wise interact with the track (only needs to know when it hits powerups and boost pads or enemies etc), then yes you could do this the way I did in an old pseudo 3D game I made many years ago in the style of Gyruss, where the X coordinate is cos(angle)*radius, where radius is the desired distance from center of the tunnel, and y is similarly sin(angle)*radius, and all you have to do is increase or decrease angle by pressing D and A.

This approach can work if the tunnel will always and at all points along its length, be the same width.

I wonder if the source code for S.T.U.N. Runner is available to look at?

more ▼

answered Oct 19 '18 at 09:24 PM

avatar image

mightyenigma
3.8k 18 20 20

avatar image mightyenigma Oct 19 '18 at 09:25 PM

Of course in Unreal it would be more like Z coordinate instead of Y (I was using a 2D game engine when I came up with that formula)

(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