1 registered members (blaurock),
752
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
path_create doesnt work
#368668
04/27/11 14:00
04/27/11 14:00
|
Joined: May 2010
Posts: 117 Germany , Dortmund
Bone
OP
Member
|
OP
Member
Joined: May 2010
Posts: 117
Germany , Dortmund
|
I tried to create a path with path_create and an entity that follow the path. var 'check' and 'node' are always 0 I write this again so you dont forget it
var dist = 0;
ENTITY* ball = ent_create("ball.mdl", vector(0,0,20),NULL);
path_create(ball,4,4);
var check = path_setnode(ball,1, vector(0,30,20),NULL);
path_setnode(ball,2, vector(3*60,3*30,70),NULL);
path_setnode(ball,3, vector(7*60,4*30,50),NULL);
path_setnode(ball,4, vector(11*60,2*30,20),NULL);
while(1){
var node = path_spline(ball,ball.x,dist);
dist += 5*time_step;
DEBUG_VAR(check, 10);
DEBUG_VAR(node,22);
wait(1);
}
|
|
|
Re: path_create doesnt work
[Re: jcl]
#368824
04/28/11 18:06
04/28/11 18:06
|
Joined: May 2010
Posts: 117 Germany , Dortmund
Bone
OP
Member
|
OP
Member
Joined: May 2010
Posts: 117
Germany , Dortmund
|
You are right. I tried it with level_load("");. With loading an empty wmb file it works.
Why is path_create limited to 256 Nodes?
Last edited by Bone; 04/28/11 19:18.
|
|
|
Re: path_create doesnt work
[Re: Bone]
#369736
05/06/11 16:57
05/06/11 16:57
|
Joined: May 2010
Posts: 117 Germany , Dortmund
Bone
OP
Member
|
OP
Member
Joined: May 2010
Posts: 117
Germany , Dortmund
|
An other problem. I want to receive the name of a path (with path_set()) which i created with path_create() and use it in ent_movepath() road1.track_path is an ENTITY Pointer with an model attached to a path.
function move_car()
{
ENTITY* car = ent_create("mini.mdl",0,0);
STRING* tpath;
path_set(road1.track_path,tpath);
printf(_chr(tpath));
ent_movepath(car,tpath, 5,2);
}
printf shows me some crazy symbols an the car dont move along the path. Also a bug or my fail?
|
|
|
Re: path_create doesnt work
[Re: Bone]
#369750
05/06/11 19:17
05/06/11 19:17
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Your fail. tpath has not been initialized and hence is a vagabonding pointer. Use
STRING* tpath = str_create("#32");
// The rest of your code goes here...
ptr_remove(tpath);
instead.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: path_create doesnt work
[Re: jcl]
#369931
05/09/11 14:48
05/09/11 14:48
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
STRING* tpath = str_create("tpath");
als0
STRING* tpath = str_create("#32"); means 32 chars of empty string.
Last edited by Quadraxas; 05/09/11 14:49.
3333333333
|
|
|
|