followPath odd behaviour
by Juan Carlos · in Torque 3D Beginner · 11/29/2010 (9:06 pm) · 14 replies
Hi all,
I have a probably dumb question.
I´m trying to make the player follow a path and I am using this script:
But as it reaches the first marker in the path, it stops.
How can I fix this?
Thanks.
I have a probably dumb question.
I´m trying to make the player follow a path and I am using this script:
LocalClientConnection.player.followPath("MissionGroup/Paths/Path1", -1);But as it reaches the first marker in the path, it stops.
How can I fix this?
Thanks.
#2
As Rex said, it is better to use an AIPlayer in these cases.
11/29/2010 (10:32 pm)
I think he wants to create a cutscene of some sort where the player character starts moving on its own, or moves to where the player clicked.As Rex said, it is better to use an AIPlayer in these cases.
#3
The player does implement AIplayer like the RTS tutorial. And when y tell it .setMoveDestination("some transform") it does move. But since I only want it to move by paths(like a board game interaction) it wont move.
How do I acomplish this?
Thanks for your speedy response.
11/30/2010 (2:24 am)
Indeed, I am trying to get the player to move when clicked.The player does implement AIplayer like the RTS tutorial. And when y tell it .setMoveDestination("some transform") it does move. But since I only want it to move by paths(like a board game interaction) it wont move.
How do I acomplish this?
Thanks for your speedy response.
#4
11/30/2010 (5:00 am)
That's strange because .followPath uses .setMoveDestination. Did you set up your path correctly?
#5
I just added it from the World Editor. Is there something else I need to give it to make the player path work?
11/30/2010 (5:52 am)
Here is my code:new SimGroup(Paths) {
canSaveDynamicFields = "1";
new Path(Path1) {
isLooping = "0";
canSaveDynamicFields = "1";
smoothing = "spline";
new Marker(Marker1) {
seqNum = "1";
type = "Normal";
msToNext = "1000";
smoothingType = "Spline";
position = "40.8196 -49.9361 2.25406";
rotation = "1 0 0 0";
scale = "1 1 1";
canSaveDynamicFields = "1";
};
new Marker(Marker2) {
seqNum = "2";
type = "Normal";
msToNext = "1000";
smoothingType = "Spline";
position = "56.5823 -31.4687 1.58354";
rotation = "1 0 0 0";
scale = "1 1 1";
canSaveDynamicFields = "1";
};
new Marker(Marker3) {
seqNum = "3";
type = "Normal";
msToNext = "1000";
smoothingType = "Spline";
position = "60.3985 -34.5889 0.963947";
rotation = "1 0 0 0";
scale = "1 1 1";
canSaveDynamicFields = "1";
};
};I just added it from the World Editor. Is there something else I need to give it to make the player path work?
#6
11/30/2010 (11:18 pm)
That looks correct. What path functions are you using? My next guess would be that the msToNext is screwing it up.
#7
I still think you'll have to 'hack' it together; in that at the proper moment, you remove the playerClass connection object and replace it with an AI Player Class which will run your course of waypoints...just my opinion here...just an 'Artist'.
12/01/2010 (7:47 am)
I'm still thinking that the Player Class does not know how to 'go to next node'....it can move to a destination...sure; but it doesn't seem to be following the next step in logic of 'go to next node'.....no task list, etc...I still think you'll have to 'hack' it together; in that at the proper moment, you remove the playerClass connection object and replace it with an AI Player Class which will run your course of waypoints...just my opinion here...just an 'Artist'.
#8
12/01/2010 (11:29 pm)
That's what I thought at first, but he says that setMoveDestination works on it. Is it a Player or AIPlayer? If it's a Player Object, then I think you just have to copy the functions in scripts/server/aiplayer.cs and make another set for Player.
#9
Good luck!
12/02/2010 (2:25 pm)
...exactly; Player will need the AI Player functions to follow the pathing, is what I'm thinking....or you swap out the Player for an AI Player to do the 'acting'...which appears to be the intent of making a 'client' 'follow' a path.Good luck!
#10
12/02/2010 (11:01 pm)
...although, that wouldn't explain why the player reaches the first node, and then stops. Did you see any console errors?
#11
I added the AIplayer to the player as the RTS prototype example in the official docs does it(I redid the procedure anyways and still no luck).
@Jonathan
There are no console errors.
Also, I have not done any change to the source code. The whole game is being done in script. Hope this gives more info.
Thanks.
12/06/2010 (10:39 pm)
@RexI added the AIplayer to the player as the RTS prototype example in the official docs does it(I redid the procedure anyways and still no luck).
@Jonathan
There are no console errors.
Also, I have not done any change to the source code. The whole game is being done in script. Hope this gives more info.
Thanks.
#12
I just noticed that it doesn't actually stop. It looks as if the player got stuck as the avatar starts to vibrate like if it was trying to move. I left it long enough stuck to notice that began to pivot on the first marker.
Does this tell anybody what I am doing wrong? I don't think it's actually stuck since the path is on top of a totally flat interior (.dif) (the board).
Thanks for your help.
12/06/2010 (10:44 pm)
PD.I just noticed that it doesn't actually stop. It looks as if the player got stuck as the avatar starts to vibrate like if it was trying to move. I left it long enough stuck to notice that began to pivot on the first marker.
Does this tell anybody what I am doing wrong? I don't think it's actually stuck since the path is on top of a totally flat interior (.dif) (the board).
Thanks for your help.
#13
Are these players supposed to do anything except follow the path? Because I remember having problems like that when they were trying to target an enemy that didn't exist.
12/07/2010 (1:17 am)
Maybe try removing the msToNext.Are these players supposed to do anything except follow the path? Because I remember having problems like that when they were trying to target an enemy that didn't exist.
#14
If it is not called,then you have a problem with the move tolerance.
The stock T3D tolerance is 0.25f, the simulation works at 32Hz ,it means that objects with speed more that
32*0.25 = 8 can skip this and will never stop.
You can directly stop the move from console,just call yourAI.stopMove();
12/07/2010 (7:51 am)
Is onReachDestination() or onMoveStuck() called ?If it is not called,then you have a problem with the move tolerance.
The stock T3D tolerance is 0.25f, the simulation works at 32Hz ,it means that objects with speed more that
32*0.25 = 8 can skip this and will never stop.
You can directly stop the move from console,just call yourAI.stopMove();
Torque Owner Rex
BrokeAss Games
localclientconnection is a live human who does all the movement inputting via the mouse....what are you trying to accomplish by having them 'follow' a path??
You may need to outline more of your intent....