Author Topic: CalcMuzzlePoint()  (Read 9075 times)

/dev/humancontroller

  • Posts: 1033
  • Turrets: +1002/-383
CalcMuzzlePoint()
« on: July 10, 2007, 05:21:22 am »
Code: [Select]
/*
===============
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:
Code: [Select]
// 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
Code: [Select]
VectorMA( muzzlePoint, 1, forward, muzzlePoint );
VectorMA( muzzlePoint, 1, right, muzzlePoint );
??2?!1!

What does Quake 3 use? Well, Quake 3 uses
Code: [Select]
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

  • Posts: 2737
  • Turrets: +291/-295
CalcMuzzlePoint()
« Reply #1 on: July 10, 2007, 05:26:34 am »
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#msg169333
Ok 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

  • Posts: 230
  • Turrets: +2/-0
    • Warrior's Stuff
CalcMuzzlePoint()
« Reply #2 on: July 10, 2007, 06:02:31 am »
Quoted from http://dretchstorm.com/node/88
Quote
Submitted 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

/dev/humancontroller

  • Posts: 1033
  • Turrets: +1002/-383
CalcMuzzlePoint()
« Reply #3 on: July 10, 2007, 06:14:48 am »
Quote from: "Warrior"
Quoted from http://dretchstorm.com/node/88
Quote
Submitted 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

  • Posts: 230
  • Turrets: +2/-0
    • Warrior's Stuff
CalcMuzzlePoint()
« Reply #4 on: July 10, 2007, 06:25:35 am »
"--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...

/dev/humancontroller

  • Posts: 1033
  • Turrets: +1002/-383
CalcMuzzlePoint()
« Reply #5 on: July 10, 2007, 06:30:57 am »
Quote from: "Warrior"
Well, in Linux we have /dev/null, so...
...
Quote from: "Warrior"
So, are you really null?
Quote from: "null"
I don't do Windows.

EDIT: null just did an OGC port AFAIK, it's not specialized for trem.

.f0rqu3

  • Guest
CalcMuzzlePoint()
« Reply #6 on: July 10, 2007, 09:13:48 am »
so aimbot is the only thing you guys can code...

benmachine

  • Posts: 915
  • Turrets: +99/-76
    • ben's machinery
CalcMuzzlePoint()
« Reply #7 on: July 10, 2007, 12:36:57 pm »
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

  • Posts: 892
  • Turrets: +3/-6
CalcMuzzlePoint()
« Reply #8 on: July 10, 2007, 04:13:26 pm »
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

  • Posts: 1033
  • Turrets: +1002/-383
CalcMuzzlePoint()
« Reply #9 on: July 10, 2007, 06:32:23 pm »
Quote from: "next_ghost"
Looks 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

  • Posts: 739
  • Turrets: +33/-13
    • http://risujin.org
Re: CalcMuzzlePoint()
« Reply #10 on: July 10, 2007, 08:49:49 pm »
Quote from: "/dev/humancontroller"
Code: [Select]

  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

  • Posts: 1033
  • Turrets: +1002/-383
Re: CalcMuzzlePoint()
« Reply #11 on: July 10, 2007, 08:58:09 pm »
Quote from: "Risujin"
Quote from: "/dev/humancontroller"
Code: [Select]

  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

  • Posts: 2737
  • Turrets: +291/-295
CalcMuzzlePoint()
« Reply #12 on: July 12, 2007, 02:01:53 am »
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#msg169333
Ok 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| #
|.@.-##
-----