Jump to content

Torque2d Path


marauder2k9

Recommended Posts

I wanted to add some more randomness to the movement to the enemies in my game, i noticed there used to be t2dpaths in torque2d, they had linear movement and bezier type movements has anyone used these before? Is someone working on implementing them again?


I might try and implement something similar but if someone is already working on it may as well join forces instead of doing the work over again.


I think there is already a behavior template made by someone for path movement but would it be better if this was hard coded?

Link to comment
Share on other sites

So far all in script, i have created a behavior that takes a list of positions and pushes them to an array that is then looped through with another behavior creating moveto actions for a target sceneobject that then follows the path and on each completion of the moveto action it loads in another moveto action to the next node in the path. Rather interesting addition i have added the ability to send a shape to the behavior this then counts the number of vertices in the shape and gets the vertices world positions and creates an array of them that is then used as a path by another sceneobject. The behavior to follow a set path is attached to the sceneobject. Still implementing steering behaviors to work with this, which i think is impossible without some source code changes to the moveto action as moveto sets the force vector directly to the next point without the ability of adding a steering force as is. In script this may be possible without using moveto but i think it would require triggers to be placed at each node in the path to change the force direction and apply a steering force to point to the next node. Doing this and adding a steering function to the moveto function should be less taxing i think but i might try it both ways and see if theres any noticeable frame drop.


Working on an AI toy with pathfinding and steering behaviors

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...