News:

Come Chat with us live! Learn how HERE!

Main Menu

CalcMuzzlePoint()

Started by /dev/humancontroller, July 10, 2007, 05:21:22 AM

/dev/humancontroller

/*
===============
CalcMuzzlePoint

set muzzle location relative to pivoting eye
===============
*/
void CalcMuzzlePoint( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint )
{
 VectorCopy( ent->s.pos.trBase, muzzlePoint );
 muzzlePoint[ 2 ] += ent->client->ps.viewheight;
 VectorMA( muzzlePoint, 1, forward, muzzlePoint );
 VectorMA( muzzlePoint, 1, right, muzzlePoint );
 // snap to integer coordinates for more efficient network bandwidth usage
 SnapVector( muzzlePoint );
}

OK, here we have our little CalcMuzzlePoint() function.
My question is: Why does it do what it does?

This function is used in like every firing/attacking function for humans and aliens:
// set aiming directions
AngleVectors( ent->client->ps.viewangles, forward, right, up );

CalcMuzzlePoint( ent, forward, right, up, muzzle );

As far as I understand AngleVectors(), it takes your basic viewing angles, and generates 3 vectors: forward: it points to the direction you're looking, right: points to the right of you, parallel with the ground you're standing on (note: wallwalkers), and up: upward, usually to the sky (note: wallwalkers). The vectors are guaranteed to be nomalized.

After that's done, we call CalcMuzzlePoint() to calculate muzzlePoint,
our result, where we're shooting/slashing/biting from.
We copy the center of our model, and then add the viewheight to get the position of our eye. (Wallwalkers must have 0 viewheigth, or this will not work.)

Next, what the hell are
VectorMA( muzzlePoint, 1, forward, muzzlePoint );
VectorMA( muzzlePoint, 1, right, muzzlePoint );
??2?!1!

What does Quake 3 use? Well, Quake 3 uses
VectorMA( muzzlePoint, 14, forward, muzzlePoint );
to locate the end of your gun. This is only relevant to the shotgun, so that the pellets don't start widely spread when shooting a wall from up close to it, and the rocket launcher (only a bit).

If this is an attempt to facilitate the rounding to integers in the SnapVector() function, it's seriously overlooked. right and forward may be all-positive, mixed or all-negative, depending on your looking directions.

The human model is 30x30x56 in size, the dretch is 30x30x30. Moving the muzzlePoint to the forward-right direction sqrt(2) far, is not noticable, and useless. I'd say use Q3 code (warning: alien attack range += 13) or nothing, to leave exact center coordinates.

THX

// dev

kevlarman

the change was committed at rev 206 (which looks like it was from when tremulous was still on sourceforge's cvs), so i doubt anyone other than timbo knows the reasoning, and i doubt that timbo remembers what it was.
Quote from: Asvarox link=topic=8622.msg169333#msg169333Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----

Warrior

Quoted from http://dretchstorm.com/node/88
QuoteSubmitted by Fallen- on Sat, 03/24/2007 - 16:15.
Groups: DSPro DSS
Class:  Dretch, Level 1

This is what an aimbot looks like:
http://misc.weedwhacker.org/misc/trem_aimbot.dm_69

from this post:
http://dretchstorm.com/node/354

recorded by WheedWhacker, from a guy called /dev/humancontroller. Is really obvious.
So, our friend interested in Tremulous source-code is a known aimbotter... apparently using the famous null's aimbot...
Well, in Linux we have /dev/null, so...
I don't care about it... lol
[glow=black,1,300]Warrior[/glow]

/dev/humancontroller

Quote from: WarriorQuoted from http://dretchstorm.com/node/88
QuoteSubmitted by Fallen- on Sat, 03/24/2007 - 16:15.
Groups: DSPro DSS
Class:  Dretch, Level 1

This is what an aimbot looks like:
http://misc.weedwhacker.org/misc/trem_aimbot.dm_69

from this post:
http://dretchstorm.com/node/354

recorded by WheedWhacker, from a guy called /dev/humancontroller. Is really obvious.
So, our friend interested in Tremulous source-code is a known aimbotter... apparently using the famous null's aimbot...
Well, in Linux we have /dev/null, so...
I don't care about it... lol

If someone says that I'm using someone else's bot again, I'm gonna smash my 3rd motinor to the wall. (lost 2 already, got killed in trem and there was nothing to punch --so-> aimbot programming)

OK basically the reason I ask about this function, is that is fucks with my 100% headshots. I hope this isn't the reason why Timbo made it like this. (oh well, coming soon: trial and error aim correction, and g_unlagged detection)

Warrior

"--so-> aimbot programming"
and
"oh well, coming soon: trial and error aim correction, and g_unlagged detection"

So, are you really null?
As I said, I don't care about who you are or if you use the aimbot or not...
[glow=black,1,300]Warrior[/glow]

/dev/humancontroller

Quote from: WarriorWell, in Linux we have /dev/null, so...
...
Quote from: WarriorSo, are you really null?
Quote from: nullI don't do Windows.
EDIT: null just did an OGC port AFAIK, it's not specialized for trem.

.f0rqu3

so aimbot is the only thing you guys can code...

benmachine

Why VectorMA is ever called with 1 as the second argument is totally beyond me. I guess it's Just One Of Those Things.
benmachine

next_ghost

Looks like dretch fix to me. Dretch is way smaller than any Quake3 player avatar.
If my answer to your problem doesn't seem helpful, it means I won't help you until you show some effort to fix your problem yourself!
1.2.0 release's been delayed for 5:48:00 already because of stupid questions.

/dev/humancontroller

Quote from: next_ghostLooks like dretch fix to me. Dretch is way smaller than any Quake3 player avatar.
No, the human_base and bsuit_bsuit are equally (width x thickness x height) 30x30x56 units, a dretch is 30x30x30 units in size. (Also, in tjw's mod, the dretch is afaik 24x24x24.)

Moving 1 unit to the right and forward is relatively small, so I think we can safely dismiss that it's some dretch fix.

Risujin

Quote from: /dev/humancontroller
 VectorMA( muzzlePoint, 1, forward, muzzlePoint );
 VectorMA( muzzlePoint, 1, right, muzzlePoint );
Just a guess but, perhaps this is supposed to nudge the muzzle point to the right to align it with the right-handed gun visually?

/dev/humancontroller

Quote from: Risujin
Quote from: /dev/humancontroller
 VectorMA( muzzlePoint, 1, forward, muzzlePoint );
 VectorMA( muzzlePoint, 1, right, muzzlePoint );
Just a guess but, perhaps this is supposed to nudge the muzzle point to the right to align it with the right-handed gun visually?
One more time, the human model is 30x30 units wide, before these functions, muzzlePoint is in your brains (+22 from the physical center of the model), moving 1 unit to the right will still be in your brains.
I don't know if aliens use guns. :wink:

kevlarman

huh? who locked this?
edit: i should check my email more often, and you should post something when you lock, paradox.
Quote from: Asvarox link=topic=8622.msg169333#msg169333Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----