I want an actor to follow another but the second actor collides with walls so I want to know how to make an actor avoid objects like walls.
Comments
tatiangMember, Sous Chef, PRO, Senior Sous-ChefPosts: 11,949
What you want is artificial intelligence. What you need is to come up with a plan for how that artificial intelligence would work (e.g. "When the actor collides with a wall, wait one second, turn in a random direction, and then move in that direction") and then we can help you figure out how to code the AI.
Think about how you would avoid a wall in real life. You might use your eyes to see it from afar, or your hands to touch is from nearby. One idea is to constrain an actor in front of the other actor and have a collide rule on the front actor that changes a boolean so that the trailing actor knows about the collision. Another is to use magnitude to figure out how far you are from a wall... that approach is probably more complex because of needing to know which wall you are near.
Comments
Think about how you would avoid a wall in real life. You might use your eyes to see it from afar, or your hands to touch is from nearby. One idea is to constrain an actor in front of the other actor and have a collide rule on the front actor that changes a boolean so that the trailing actor knows about the collision. Another is to use magnitude to figure out how far you are from a wall... that approach is probably more complex because of needing to know which wall you are near.