[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - [FTE] Auto adjust collision after .scale in CSCQ

[FTE] Auto adjust collision after .scale in CSCQ

Discuss CSQC related programming.

Moderator: InsideQC Admins

[FTE] Auto adjust collision after .scale in CSCQ

Postby toneddu2000 » Fri Dec 02, 2016 9:52 am

- my first commercial game, made with FTEQW game engine
toneddu2000
 
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: [FTE] Auto adjust collision after .scale in CSCQ

Postby toneddu2000 » Sat Dec 10, 2016 9:44 pm

really anyone? Even Spike can't think of a workaround? It's quite frustrating to me to fall on this trivial glitch.. I COULD use a different approach but it wouldn't be so satisfying as this one! :razz:
- my first commercial game, made with FTEQW game engine
toneddu2000
 
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: [FTE] Auto adjust collision after .scale in CSCQ

Postby Spike » Sun Dec 11, 2016 7:25 am

if you're calling that repeatedly then you're accumulating those scale changes. which is probably not what you want...
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: [FTE] Auto adjust collision after .scale in CSCQ

Postby toneddu2000 » Sun Dec 11, 2016 8:20 am

yeah, you're right, but still I don't understand why it increases size even if I don't change player position. And then, it gets smaller and smaller, becoming invisible after some sec.
calling setsize after every .scale operation, shouldn't clear things up?
- my first commercial game, made with FTEQW game engine
toneddu2000
 
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: [FTE] Auto adjust collision after .scale in CSCQ

Postby Spike » Sun Dec 11, 2016 11:39 am

self.scale = vlen(self.origin - player.origin) / limit;
s = self.scale / 2;
minx = self.mins_x * s; //determine the new model mins

so .scale is set according to the distance to the entity.
and that's fine...
but if your scale is *2, why are you calculating mins as though its scale 1?
and then, why are youreplacing .scale, and yet rescaling mins+maxs since the last call? if you're setting .scale directly you really ought to be setting the mins+maxs relative to their original values like you're rescaling .scale relative to its original value of 1.
also, why use .size when .maxs is easier and more consistent?


one thing you might want to try is using a mins_z of 0. this means you don't have to move the entity up/down as it gets resized. but will need to adjust your model too.
that said, you will need to use tracebox to see if the spot is empty enought for a slightly larger model to fit there.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: [FTE] Auto adjust collision after .scale in CSCQ

Postby toneddu2000 » Mon Dec 12, 2016 5:49 pm

well, I tried almost everything but nothing changed. I guess I'll go for a static pre-defined increase / decrease way (a thing like "if distance > x setsize(blah)")
I think that a new way of determine collisions (possible via collision meshes) in FTE, would need to be taken in consideration one day, Spike, because it's a really pain in the "@X to manage dynamic collisions in real time (I did my best with tracebox but collision meshes are a MUST, IMO).

Could you please tell me where collisions are handled in engine?
- my first commercial game, made with FTEQW game engine
toneddu2000
 
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: [FTE] Auto adjust collision after .scale in CSCQ

Postby Spike » Tue Dec 13, 2016 3:18 am

fte still uses world.c to determine when something may need to collide, while pmovetst.c does the job for player prediction colliding against other stuff. its these files that decide which objects need to collide against others. however, the actual collisions themselves are done on a per-model basis, with callbacks specified via impactee->funcs.NativeTrace. If null then only bbox/bbox colisions can happen thanks to fallbacks, while if its set then hitmodel or bsp collisions can be used.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: [FTE] Auto adjust collision after .scale in CSCQ

Postby toneddu2000 » Tue Dec 13, 2016 8:51 pm

As always I made a mistake in writing my question! My correct question should have been (and also the title of the thread): how engine sets bounding boxes for meshes? Did engine updates bboxes per-frame?
I read World_InitBoxHull () and World_HullForBox() in world.c but I wonder if it's possible to replicate a Bbox set function in a "update" function to re-update every x frame bounding boxes.

Collisions are not my problem, as long as I use tracebox, but I neet that bbox encompass totally model, as csqc defs defines.
- my first commercial game, made with FTEQW game engine
toneddu2000
 
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: [FTE] Auto adjust collision after .scale in CSCQ

Postby frag.machine » Wed Dec 14, 2016 11:16 am

I don't know if what I'll say applies to your use case, or even if it's valid or recommended in CSQC. But when I made a shrinking gun/attack some time ago I ensured that the .mins and .maxs vectors were directly proportional to .scale (obviously, like Spike already said, I stored the original values to be able to recalc with precision and to restore the entity back once the effect worn off). BTW this allowed me to implement inclusive the "stomp over" a monster attack, Duke Nukem style. From what you say it seems to me your intention is to make the entity look approximately the same size to the player, regardless the distance, right ?
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2120
Joined: Sat Nov 25, 2006 1:49 pm

Re: [FTE] Auto adjust collision after .scale in CSCQ

Postby toneddu2000 » Wed Dec 14, 2016 1:57 pm

- my first commercial game, made with FTEQW game engine
toneddu2000
 
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: [FTE] Auto adjust collision after .scale in CSCQ

Postby frag.machine » Wed Dec 14, 2016 4:55 pm

I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2120
Joined: Sat Nov 25, 2006 1:49 pm

Re: [FTE] Auto adjust collision after .scale in CSCQ

Postby toneddu2000 » Wed Dec 14, 2016 7:08 pm

Thanks a lot frag.machine, it worked! I know now where I was making a mistake with my old code.
I forgot, when entity is spawned, to save oldscale, oldmins and oldmaxs. Without them, the mins and maxs value will be set to 0, and, in think function, when multiplied * any value, they will produce only 0;
The clamp check it's also a great thing because it prevents over and down scaling

Many thanks again man! :biggrin:
- my first commercial game, made with FTEQW game engine
toneddu2000
 
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy


Return to CSQC Programming

Who is online

Users browsing this forum: Google [Bot] and 1 guest