Sign in to follow this  
lucky6969b

How can I make an object follow a fixed path (track)? but...

Recommended Posts

The vehicle called the VNA will follow a fixed path which is the aisle between the rackings.

But at some point, the VNA will be able to stop at each bay. What is the best way to move this object?

Waypoints, or weighed A* (don't know what that's called), but something like the path within the straight line

will be given the highest score.

Thanks

Jack

Edited by lucky6969b

Share this post


Link to post
Share on other sites

I am not sure what is your problem.

If you want to move object to specific location:

1. (opt) rotate it to face target location

2.

targetLocation = Path[currNodeInx].node_pos
objectPos += (targetLocation - objectPos).normalize() * moveSpeed

3. test if reached destination and increment path index:

minimumDist = 0.1 // minimum dist to target to consider it has reached its current destination
minimumDistSq = minimumDist*minimumDist // squared
if((targetLocation - objectPos).lengthSq() < minimumDistSq)
{
    currNodeInx++ // or decrement if you want to go back, or wrap around so it will loop thru the path
   
}

4. you can add something like weight to Path to modify moveSpeed so object will move slower/faster

targetLocation = Path[currNodeInx].node_pos
objectPos += (targetLocation - objectPos).normalize() * moveSpeed * Path[currNodeInx].weight
Edited by belfegor

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this