|
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible),
637
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
c_trace question
#225700
09/05/08 19:28
09/05/08 19:28
|
Joined: Aug 2006
Posts: 155
RyuMaster
OP
Member
|
OP
Member
Joined: Aug 2006
Posts: 155
|
Hi! I need some help figuring out how c_trace works. I have robot model, and a box on my scene. Currently, this how it works: if (c_trace(my.x,vector(my.x,my.y + 10,my.z),IGNORE_ME | IGNORE_PASSABLE | USE_BOX) > 0) { you.y+=10; } When robot is near the box, box moves by 10. But, it happens, no matter is robot facing the box, or not. How can I check, if robot is facing the box? Do I have to track it additionaly, or c_trace can handle this?
What kills me not, that makes me stronger.
***Working on RPG/RTS***
|
|
|
Re: c_trace question
[Re: RyuMaster]
#225717
09/05/08 20:39
09/05/08 20:39
|
Joined: Jun 2008
Posts: 428
Rasch
Senior Member
|
Senior Member
Joined: Jun 2008
Posts: 428
|
at the moment you trace belong the Y-Axis it doesnīt care where your robot is facing it traces from his position belong the Y-Axis. Take this code from me  i can explain if you want  first define a variable outside the action and then take this in a while loop 
var trace_coords;
vec_set(trace_coords.x, vector(10000, 0, 0);
vec_rotate(trace_coords.x, my.pan);
vec_add(trace_coords.x, my.x);
c_trace(my.x, trace_coords.x, IGNORE_ME | IGNORE_PASSABLE);
if (!you) // hit a wall?
{
wait(1);
}
else
{
you..y += 10;
}
|
|
|
Re: c_trace question
[Re: RyuMaster]
#225743
09/05/08 21:57
09/05/08 21:57
|
Joined: Aug 2006
Posts: 155
RyuMaster
OP
Member
|
OP
Member
Joined: Aug 2006
Posts: 155
|
Yai, thanks! I'll see if it works for me, but currently I can not get is started. Is this Lite-C? I get this error: x is not member of the function because of this line " trace_coords.x" Then I trying to change " var trace_coords " to " VECTOR trace_coords". I thought maybe "x" is not found because of bad variable type. But now I get syntax error at the same code line. Any ideas what might be wrong?
What kills me not, that makes me stronger.
***Working on RPG/RTS***
|
|
|
Re: c_trace question
[Re: RyuMaster]
#225751
09/05/08 22:12
09/05/08 22:12
|
Joined: Aug 2006
Posts: 155
RyuMaster
OP
Member
|
OP
Member
Joined: Aug 2006
Posts: 155
|
Not working either, probably because I use Lite-C and it has some differences. Anyway, while I have You brilliant part of code  , I can always stick to manual and try to adapt it to Lite-C. Hopefully I'll get lucky...
What kills me not, that makes me stronger.
***Working on RPG/RTS***
|
|
|
Re: c_trace question
[Re: RyuMaster]
#225753
09/05/08 22:16
09/05/08 22:16
|
Joined: Jun 2008
Posts: 428
Rasch
Senior Member
|
Senior Member
Joined: Jun 2008
Posts: 428
|
yeah try that ^^ it should work otherwise try this var trace_coords[3]; if this donīt work i really donīt know cause i donīt want to use lite-c as long as it isnīt needed 
|
|
|
Re: c_trace question
[Re: Rasch]
#225768
09/05/08 22:55
09/05/08 22:55
|
Joined: Aug 2006
Posts: 155
RyuMaster
OP
Member
|
OP
Member
Joined: Aug 2006
Posts: 155
|
Changing vec_set to this soled the problem:
VECTOR trace_coords; trace_coords.x = 100; trace_coords.y = 0; trace_coords.z = 0;
Thanks, it really works! Just I wonder why and how:) Well, I hope I'll get it one day.
What kills me not, that makes me stronger.
***Working on RPG/RTS***
|
|
|
Re: c_trace question
[Re: RyuMaster]
#225769
09/05/08 22:58
09/05/08 22:58
|
Joined: Jun 2008
Posts: 428
Rasch
Senior Member
|
Senior Member
Joined: Jun 2008
Posts: 428
|
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|