Game Development Community

Paths in Torque X

by Matthew Baxter · in Torque X 2D · 09/13/2007 (4:17 am) · 3 replies

Hi,

I was wondering how you would create paths in Torque X Builder. In Torque Game Builder under Create then Other there is an easy way to create a Path. What would be the best way to do something similar in TXB now? Are Paths going to be added to TXB in the future?

Thanks

About the author

Recent Threads

  • Ball physics

  • #1
    09/13/2007 (8:50 am)
    Paths do not exist in TorqueX. There was another "paths in TorqueX" thread in which GG said it is not a high priority, so I wouldn't hold my breath for it.

    Well, off the top of my head, you could make a PathComponent, which has a List Property, so you can add as many positions to it from the editor as you want, then in your PathComponent::ProcessTick you handle setting the velocity to head towards the next one (you would add the path component to an object you want to follow it).

    In TGB paths are actually their own objects and the positions in the path are in object space, so you cam move the path around and it moves all the path nodes. If you wanted you could make the points specified in the path relative to the position of its owner, but I think that would get more confusing than helpful.

    You can add properties like "Loop" or even delagates triggered "onNodeArrival" and "onPathFinished". It would be a pretty cool little resource actually. Unfortunately, theres no way to visually setup the path, you would have to just type in the positions (or create a black sceneobject and move it around to the positions you want copy and pasting its position).
    #2
    11/11/2007 (12:24 pm)
    I'm trying to get this idea working - how do you "set the velocity to head towards" the vectors created in your list?

    Thanks
    #3
    11/19/2007 (4:27 pm)
    The vector from point a A to another point B is: B - A

    Normalize the result and scale it, and you have your velocity.