Adding logic to spawn units randomly

By
-
Login to Follow
-
Industry
  • Games
  • Design Visualization
Subject
  • Foundation
  • General
  • Action
  • Building Levels
  • Creating Interactions
  • Creating Effects
  • Motion Graphics
  • Environment
  • Simulation and Effects
  • Workflow
Products
  • Stingray
Skill Level
  • Intermediate
Duration
24 min

What to Expect

In the third part of this tutorial series we will focus on string manipulation. Now that we have created a navmesh and have our unit moving across the navmesh, we will want to spruce up the interactivity. By using some simple but clever string manipulation, we will generate random start and end points for our tanks to move from and to.

Knowing how to manage strings is an essential skill for both programming and flow control. In this tutorial we will use the variables we created in part 2 and generate strings to call those variables randomly.


Tutorial Steps

  1. In Level Flow, create logic to generate random start and end point numbers.

  2. Add additional logic to ensure both endpoint and start point are not the same.

  3. Now that we have 2 unique numbers to work with, create the required strings for spawn position, goal position, and the goals unit variable name.

  4. Using these Generated Names, Spawn the Tank on my_spawn_pos, Set the destination on my_goal_pos and move the tank.

  5. Test the Results. Upon clicking, tanks should now spawn at random flags and move to random goals. Note the fact that your tanks make instant changes of direction.


  6. Edit the Bot. NavTag_Layer “use_channel = true” to use the spline trajectories to smooth the motion.


  7. Test again. Note the smoothed turning of the tanks now.

Posted By
Tags
  • Stingray
  • Foundation
  • General
  • Action
  • Building Levels
  • Creating Interactions
  • Creating Effects
  • Motion Graphics
  • Environment
  • Simulation and Effects
  • Workflow
0 Comments
To post a comment please login or register
*Save $66 per month on Autodesk's Suggested Retail Price (SRP) when purchasing 1 year term 3ds Max or Maya subscription.