- Home /
Spider Wall Movement Between Waypoints
I'd like to make a script where an object walks between 2 waypoints and will travel between them in the manor described by the given picture.
I've tried various things using raycasts but they never work properly.
The world I'm working in is a sidescroller in 3D space. (So it only uses x and y coordinates)
Answer by shadowpuppet · Jan 29, 2017 at 03:08 AM
I would just add more waypoints, one at each of the bends, The spider doesn't have to stop at them but when hits them gets the info to travel to the next.I really don't see any other way without complex coding instructing it to move so much -y, so much in x, then so much in y again etc etc.That's kind of the purpose of waypoints to establish markers that when the object reaches them they receive new instructions. Just have the instructions be to go to the next. I have enemies patrolling all over my map walking down one street, hitting a waypoint and turning to go to the next
more specific, have a navmesh on the spider and each waypoint a triggerzone that :
private Nav$$anonymous$$eshAgent agent;
public GameObject goHere;// this where you put the next waypoint
}
void Start () {
agent =GetComponent<Nav$$anonymous$$eshAgent>();
void OnTriggerEnter(Collider other)
{
if(other.tag == "spider")
agent.SetDestination(goHere.transform.position);
Your answer
Follow this Question
Related Questions
Making a bubble level (not a game but work tool) 1 Answer
Programming Wall Climbing 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Climb Wall: How do I change key input from horizontal to vertical? 2 Answers