Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 lucky6969b   Members   -  Reputation: 636

Like
0Likes
Like

Posted 28 June 2014 - 03:22 PM

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, 28 June 2014 - 03:27 PM.


Sponsor:

#2 ApochPiQ   Moderators   -  Reputation: 16413

Like
0Likes
Like

Posted 28 June 2014 - 04:28 PM

Are you trying to visit a specific location or all locations? These are very different problems.

#3 lucky6969b   Members   -  Reputation: 636

Like
0Likes
Like

Posted 29 June 2014 - 10:58 PM

Yes, I'd like to visit specific locations, it's like a vehicle on rail in a straight line back and forth.

Thanks

Jack



#4 belfegor   Crossbones+   -  Reputation: 2722

Like
0Likes
Like

Posted 30 June 2014 - 07:35 AM

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, 30 June 2014 - 07:37 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS