|
c_trace in certain direction
#357617
02/07/11 21:54
02/07/11 21:54
|
Joined: Mar 2009
Posts: 186
Valdsator
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 186
|
I looked through the manual and found out how to have something c_trace in the direction the entity is facing. For some reason though, when the entity does this, it immediately detects something with it's trace. But, when I put on IGNORE_WORLD, it doesn't detect it anymore. Here's my code:
c_trace(my.x,vec_rotate(vector(5,0,0),my.pan),IGNORE_ME|IGNORE_YOU);
Is this doing something different? I assume it's setting a c_trace from the origin of the entity, to 5 units in the direction the entity is facing. What am I doing wrong? Thanks in advance.
|
|
|
Re: c_trace in certain direction
[Re: Valdsator]
#357628
02/07/11 22:39
02/07/11 22:39
|
Joined: Sep 2009
Posts: 993 Budapest
Aku_Aku
User
|
User
Joined: Sep 2009
Posts: 993
Budapest
|
Try to use this modifier: SCAN_TEXTURE Perhaps you can get information about the objects what was hit. From the manual:
if (hit.texname) printf("Floor texture: %s",hit.texname);
|
|
|
Re: c_trace in certain direction
[Re: Logan]
#357664
02/08/11 00:10
02/08/11 00:10
|
Joined: Mar 2009
Posts: 186
Valdsator
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 186
|
Alright, using the texture name method, I found out it was hitting the floor of the level (the entity is a bullet, by the way). So I did what Logan said, but for some reason it still didn't work. I found it was still hitting the floor, so I then made the code this:
c_trace(vector(my.x,my.y,my.z),vec_rotate(vector(my.x+5,my.y,my.z),my.pan),IGNORE_ME|IGNORE_YOU);
This actually somewhat works. I guess the c_trace was coming from the origin of the entity, and just pointing at the floor. So I changed the 5,0,0 vector to that, and it then started working. But, now the c_trace seems a bit screwy. Sometimes the bullets don't activate the c_trace and slide along the wall, sometimes they make each other disappear, and sometimes they disappear before they should (too far away from the walls). I assume I changed the 5,0,0 to the wrong thing, so it's doing something very weird at the moment. So since the c_trace was going from the entity down to the floor, what should I change the c_trace code to?
|
|
|
Re: c_trace in certain direction
[Re: Logan]
#357673
02/08/11 02:27
02/08/11 02:27
|
Joined: Mar 2009
Posts: 186
Valdsator
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 186
|
c_trace(my.x,vec_add(vec_rotate(vector(5,0,0),my.pan),my.x),IGNORE_ME|IGNORE_YOU); That didn't really seem to work for some reason, but I decided I'll try out the EVENT_BLOCK and EVENT_ENTITY way and it works perfectly. I guess I tried using c_trace because in the manual, on c_scan it says you shouldn't use c_scan for gunshots, but c_trace. It might be talking about bullets that don't travel, but just teleport. I might end up doing that, but for now this works. Thanks dude!
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|