Placing Objects Along the Path
Using the PathFollow3D node to help place objects better.
Last updated
Using the PathFollow3D node to help place objects better.
Last updated
All of Secret Rings gameplay uses an underlying Path that sonic moves along for the entire stage.
You can use the path and a PathFollow3D
node in the editor to place objects quickly and efficiently by simply "sliding" along the path.
After importing the main Static.tscn, make sure to enable "Editable Children" on the the imported scene.
Find the paths for the stage from the Static.tscn node. There are often multiple paths for a given level located under a Node named "Path."
Find the path that covers the section of the stage you are working on. You can select a path and press [F] in the 3D view (or double click the node's icon in the tree view) to snap the 3D view to the selected object.
Look for the control points that represent the path to see where it travels.
Once you have the path you need, right click it in the Scene Tree and click "Add Child Node."
In the Add Child popup, search for "pathfollow" and select the PathFollow3D
node.
You are now set up. Focus on the new node (using [F] or double clicking its icon in the Scene Tree) to see where it is.
You can treat your PathFollow3D
Node like a platform that moves along the stage, placing objects as it travels. Use the PathFollow3D
Node's "Progress" value to move the node along the path.
When update the "Progress" value, click and drag on the number part of the property instead of using the slider to get finer control. Press [F] as needed to re-center the PathFollow3D
node in the 3D view.
Once you position the node roughly where you need the item, [RIGHT CLICK] on the PathFollow3D
node and select either "Instantiate Child Scene" or "Add Child Node" as needed.
Now any node you add will be positioned with its origin directly on the main path.
Move the object until you it appears as it needs to. With both "Local Transform" enabled in the editor and "Tilt Enabled" in the PathFollow3D
node options, you can have objects follow the curve and tilt of the main path.
One way to do this is to can [CLICK] and [DRAG] the object node in the Scene Tree to where it needs to go.
Alternatively, if the Scene Tree is cluttered with objects, it may be easier to [RIGHT CLICK] your object node and select "Reparent" instead.
That's it! Keep moving the PathFollow3D
node and placing objects as needed to add the rest of the stage's objects. Once you are finished placing objects, remember to delete the PathFollow3D
node from the Scene Tree.
After you are finished placing your object node, it needs to be moved from Static to the Act node. Typically you will do this by reparenting the object node to a node.