Raised This Month: $51 Target: $400
 12% 

EngFunc_TraceTexture


Post New Thread Reply   
 
Thread Tools Display Modes
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-25-2009 , 08:48   Re: EngFunc_TraceTexture
Reply With Quote #11

Quote:
Originally Posted by Arkshine View Post
I don't think, and I don't see anything wrong. Plus, it works fine if you do like my code above.

In CBaseEntity *pEntity = CBaseEntity::Instance(ptr->pHit);

Instance() returns pent->pvPrivateData; and as comment we can read :


get_tr2() will return -1 if not there is not hit. I'm not pro at all but I wondering if the wall is not attributed with a specific index managed by the engine and ptr->pHit would not return 0 in this case.
Ok, will do some tests. I also have seen that there isn't anything wrong.
Edit: Does pent->pvPrivateData really make the difference?
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 08-25-2009 at 08:52.
ot_207 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-25-2009 , 08:59   Re: EngFunc_TraceTexture
Reply With Quote #12

Actually, it works lol.

Just tried in TraceAttack, gun position as origin and direction * 8192.0 as end position, and it works.

Code:
UTIL_GetGunPosition( Attacker, Origin ); VectorMA( Origin, 8192.0, Direction, EndPos );         engfunc( EngFunc_TraceTexture, max( 0, get_tr2( TraceHandle, TR_pHit ) ) , Origin, EndPos, Texture, charsmax( Texture ) );

Tested, whatever it's an entity or not. What is important is to trace the longest line possible.
__________________

Last edited by Arkshine; 08-25-2009 at 09:09.
Arkshine is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-25-2009 , 09:15   Re: EngFunc_TraceTexture
Reply With Quote #13

Direction meaning? The angles turned into vector? And multiplied by 8192.0 times?
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-25-2009 , 09:16   Re: EngFunc_TraceTexture
Reply With Quote #14

What you have to understand is the end point has to be the most far possible from the start point. ( don't know why ). I use 8192.0 because AFAIK it's the max size of a map can be.

TraceAttack was just an example, I've used the Direction to calculate the end point in the direction I shoot.
__________________

Last edited by Arkshine; 08-25-2009 at 09:20.
Arkshine is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-25-2009 , 09:20   Re: EngFunc_TraceTexture
Reply With Quote #15

So it is important for example.
I want to shoot from position x to y.
It is a good idea to substract those vectors in z vector.
Multiply that vector with 160000.0 then add to the x point saving it as y.
Then trace from x to y?

Code:

PHP Code:
// gunpositon[3]
// endpos[3]
new Float:z[3]
xs_vec_sub(endposgunpositionz)
xs_vec_mul_scalar(z10000.0z)
xs_vec_add(gunpositionzendpos)
TRACE(gunposendpos
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-25-2009 , 09:23   Re: EngFunc_TraceTexture
Reply With Quote #16

Well yes. Though the max size of a map is 8192.0 if I'm right. But you could use any high value I guess > 8192.0. For some reason if the trace is too short it crashes.
__________________
Arkshine is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-25-2009 , 09:26   Re: EngFunc_TraceTexture
Reply With Quote #17

Quote:
Originally Posted by Arkshine View Post
Well yes. Though the max size of a map is 8192.0 if I'm right. But you could use any high value I guess > 8192.0. For some reason if the trace is too short it crashes.
Ok, tested it and it works! Thanks a lot! So the engine had it all along .
I think that what we have spoken here should be added to explained functions. It would be useful for people to know.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 04-11-2018 , 07:38   Re: EngFunc_TraceTexture
Reply With Quote #18

Quote:
Originally Posted by Arkshine View Post
Well yes. Though the max size of a map is 8192.0 if I'm right. But you could use any high value I guess > 8192.0. For some reason if the trace is too short it crashes.
Hello. Any way to get texture of the entity that I'm actually aiming at and not the ground texture? So even if I look at an entity that is above me, no matter the distance, I'd like to return it's texture type.
DarthMan is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode