I have these nodes set up for a ship to move towards over time with out looking stops then repeats in a sequence.
like so:
1 2 3 1 2 3 1 2...
THE PROBLEMS i keep having either come from the inability to switch direction or the ship ignores all collision which i would like to be able to shoot it with actual objects.
Ignores all Collision:
Vector3 currentPosition = thisShip.transform.position;
Vector3 directionOfTravel = targetPosition - currentPosition;
directionOfTravel.Normalize();
thisShip.MovePosition(currentPosition + directionOfTravel * speed * Time.smoothDeltaTime);
This one works perfectly but because MovePosition is a kin to translate and actually teleports objects it ignores all collision which i need.
Can't Switch Direction:
Vector3 currentPosition = thisShip.transform.position;
Vector3 directionOfTravel = targetPosition - currentPosition;
directionOfTravel.Normalize();
thisShip.AddRelativeForce(currentPosition + directionOfTravel * speed * Time.smoothDeltaTime, ForceMode.Force);
so in this one i try to stop the rigid body by returning its velocity to zero and it does stop for a second but continues in its original direction anyways.
thisShip.velocity = Vector3.zero; // Use this to pause object
I believe i need another method of movement (maybe use a CC) or maybe i can make AddRelativeForce work and be able to switch targets like MovePosition does. I'd really like to get this one thing done so i can move on to other parts of the project.