How do I make Path Follow in 3D?

Not favoritedFavorited Favorited 0 favourites
  • 2 posts
From the Asset Store
Template for a basketball game with a 3D aspect (illusion of 3D)
  • I’ve been exploring Construct 3’s 3D features and I’m really impressed! However, some behaviors—like the "Move to object" behavior—only work in 2D; they ignore the Z-axis. I’m currently building a sort of 3D Sonic-style level. The level itself is ready. Now, I want the player to enter a loop-the-loop in 3D and automatically follow a path that spirals upwards. I tried using timeline animations to solve this; it worked for the first section, but for the second, I ended up being teleported 14,000 pixels away. Then I tried placing numerous 3D shapes as waypoints and setting the player to "Move to object" (moving to waypoint 1, then 2, 3, etc.) upon contact. However, the system completely ignores the Z-axis here, so the player just moves along the ground without gaining any height. Does pathfinding work in 3D? And if so, how? I want the player to automatically follow a 3D path—designed like a roller coaster—that moves vertically (up and down) as well as horizontally.

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You probably have to do the movement manually with events until behaviors get updated to support 3d.

    One way could be to give the node sprites a next variable that you set to the uid of the next node you want to move to.

    In the same way you can give the sprite you want to follow the path a variable called target which is the uid of the node it's currently moving toward.

    Then to move the sprite, and update the target node when a node is reached you could do:

    | Global number d‎ = 0
    | Global number speed‎ = 200
    + System: For each Sprite
    + node: Pick instance with UID sprite.target
    -> System: Set d to distance3d(Sprite.X,Sprite.Y,Sprite.Z, node.X, node.Y, node.Z)
    -> Sprite: Set position to (Self.X+(node.X-Self.X)÷d×speed×dt, Self.Y+(node.Y-Self.Y)÷d×speed×dt, Self.Z+(node.Z-Self.Z)÷d×speed×dt)
    ----+ System: d < 16
    -----> Sprite: Set target to node.next
Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)