Forum

[FTE] [SOLVED] Tracebox for collisions on meshes

Discuss CSQC related programming.

Moderator: InsideQC Admins

[FTE] [SOLVED] Tracebox for collisions on meshes

Postby toneddu2000 » Tue Nov 07, 2017 2:52 pm

Hi guys, I'm trying to create for craFTEr a system to permit player to collide with static meshes. Take for example this simple mesh, like a rudimentary passage
Image
I use tracebox (and then trace_fraction) to read if player is in front of one of the pillars or he's in the middle of the 2 pillars and so, into void space.

1. If I set .solid to SOLID_NOT and then use tracebox with MOVE_HITMODEL, tracebox can't see the mesh, even with MOVE_EVERYTHING. But FTE defs say that
Code: Select all
const float MOVE_EVERYTHING = 32;   /* This type of trace will hit solids and triggers alike. Even non-solid entities. */
Which isn't true, since meshes with SOLID_NOT won't be seen

2. If I set .solid to SOLID_BBOX and then use tracebox with MOVE_HITMODEL, trace fraction works, so trace sees mesh, but engine by default will block any collision with entities with .solid set to SOLID_BBOX or SOLID_SLIDEBOX or SOLID_BSP. So, even I create a super cool code to manage collision, it simply work the way the engine wants, not my way!

My question is, there's the possibility to disable collisions on the engine so developers can set them via tracebox, or is it possible to understand why tracebox with MOVE_EVERYTHING can't trace non solid entities? Is it a only-CSQC game problem? Or is it the same with SSQC?

Thanks to anyone that has an intuition! :biggrin:
Last edited by toneddu2000 on Tue Nov 07, 2017 4:02 pm, edited 1 time in total.
toneddu2000
 
Posts: 1314
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: [FTE] Tracebox for collisions on meshes

Postby toneddu2000 » Tue Nov 07, 2017 3:25 pm

Little update: I notice that, even setting player solid to SOLID_NOT, and getting close to an entity with SOLID_BBOX, player won't go trough. Weird, I thought it'd happen only when 2 entities with solid ==SOLID_BBOX||SOLID_BSP||SOLID_SLIDEBOX would collide...

#EDIT: using instead solid = SOLID_TRIGGER and then tracebox with MOVE_TRIGGERS, wouldn't trace meshes at all...
toneddu2000
 
Posts: 1314
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: [FTE] Tracebox for collisions on meshes

Postby toneddu2000 » Tue Nov 07, 2017 4:01 pm

My fault: I used 2 tracebox one inside another (one for trace collision and second for trace movements) and second one was set to MOVE_NORMAL! :mrgreen:
Ok, now it works, cool! So, basically it's solved but I'm still curious why MOVE_EVERYTHING doesn't work with SOLID_NOT meshes

Hurray now craFTEr has static meshes collisions!!yay :biggrin:
toneddu2000
 
Posts: 1314
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: [FTE] Tracebox for collisions on meshes

Postby Spike » Tue Nov 07, 2017 4:13 pm

tracebox doesn't normally consider the solidity of the moving entity. if its non-solid then why the hell is it trying to collide...
triggers are non-solid (or rather, one-way). they're kinda evil. don't use them for anything but triggers.
instead of move_hitmodel on the mover's traces, you can use solid_bsp on the impactee. just make sure its movetype_none otherwise things get weird (tracebox traces a box[or possibly a capsule], not complex trisoup). for hitmodel/equivelent to work you must make sure the absbox of the trisoup covers the entire thing, otherwise it might not be noticed until its too late (this may be a problem without solid_bsp, especially when things are rotated).

make sure you use setorigin and NOT directly hacking .origin. Yes, there are cases where you can directly change the origin, but without a setorigin afterwards the engine's collision structures will not be updated. so make sure you do it before control returns to the engine or another (moving) ent.
note that the engine ignores collisions where one ent is the owner of the other (both ways. otherwise rockets would blow up in your face).
you can also ignore collisions using dimension_solid/hit.
there's also rules about solid_corpse which are kinda annoying to work with.
Additionally you can mess around with .hitcontentsmaski and fancy brushcontents flags (solid water? you got it!).

MOVE_TRIGGERS and MOVE_EVERYTHING are hacks. FL_FINDABLE_NONSOLID is required to allow MOVE_EVERYTHING to hit nonsolid/trigger entities. otherwise it simply bypasses the engine's collision structures (which makes it slow, so why bother?). this flag also applies to findradius. MOVE_TRIGGER is annoying whener there's a trigger_multiple etc in the way.
Spike
 
Posts: 2883
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: [FTE] [SOLVED] Tracebox for collisions on meshes

Postby toneddu2000 » Tue Nov 07, 2017 4:39 pm

Thanks Spike, as mentioned above my error was that I nested 2 tracebox and last one it was remained set to MOVE_NORMAL!

Spike wrote:you can also ignore collisions using dimension_solid/hit.
Never heard of hit, I'll take a look

Spike wrote:MOVE_TRIGGERS and MOVE_EVERYTHING are hacks. FL_FINDABLE_NONSOLID is required to allow MOVE_EVERYTHING to hit nonsolid/trigger entities. otherwise it simply bypasses the engine's collision structures (which makes it slow, so why bother?). this flag also applies to findradius. MOVE_TRIGGER is annoying whener there's a trigger_multiple etc in the way.

Ok, I'll try that too.

Thanks for the clarification
toneddu2000
 
Posts: 1314
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy


Return to CSQC Programming

Who is online

Users browsing this forum: No registered users and 1 guest