Forum

Adjusting nails to new r_viewmodeloffset

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Adjusting nails to new r_viewmodeloffset

Postby JasonX » Sun Apr 10, 2011 7:42 pm

I'm using Baker's r_viewmodeloffset and i'm trying to adjust the nails based on that. Is it possible? Or is the tutorial bugged?

viewtopic.php?t=1247
JasonX
 
Posts: 411
Joined: Tue Apr 21, 2009 2:08 pm

Re: Adjusting nails to new r_viewmodeloffset

Postby Baker » Sun Apr 10, 2011 8:07 pm

JasonX wrote:I'm using Baker's r_viewmodeloffset and i'm trying to adjust the nails based on that. Is it possible? Or is the tutorial bugged?

viewtopic.php?t=1247


r_viewmodeloffset adjusts the viewmodel's appearance on the client.

The server doesn't know anything about client preference settings (i.e., the server does not know your viewsize, fov, your mouse sensitivity, the value of a view variable like r_viewmodeloffset, etc.)

And the origin and angles of nails being fired lives in the QuakeC source of progs.dat and is hardcoded:

Using the Rocket as an example ....

Code: Select all
/*
================
W_FireRocket
================
*/
void() W_FireRocket =
{
    local    entity missile, mpuff;
   
    self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
   
    sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);

    self.punchangle_x = -2;

    missile = spawn ();
    missile.owner = self;
    missile.movetype = MOVETYPE_FLYMISSILE;
    missile.solid = SOLID_BBOX;
    missile.classname = "missile";
       
// set missile speed   

    makevectors (self.v_angle);
    missile.velocity = aim(self, 1000);
    missile.velocity = missile.velocity * 1000;
    missile.angles = vectoangles(missile.velocity);
   
    missile.touch = T_MissileTouch;
   
// set missile duration
    missile.nextthink = time + 5;
    missile.think = SUB_Remove;

    setmodel (missile, "progs/missile.mdl");
    setsize (missile, '0 0 0', '0 0 0');       
    setorigin (missile, self.origin + v_forward*8 + '0 0 16');
};


Notice the set origin ^^^ [this sets the initial position of the rocket] is the player location (self.origin) plus a little bit of forward padding [i.e, the start origin is directly in front of the player]. [QuakeC isn't really my strong suit, but nevertheless ...].

You'd have to play with the setorigin a bit to make a rocket fire from the side a little, but you'd also have to play with the angles a bit too doing a destination calculation so it achieved a somewhat similar intended fire angle.

You'd be better off asking the QuakeC guys how to achieve that, I'm sure there has to be angle calc code for some side mounted weapon somewhere. I'm not too familiar with the QuakeC math functions versus, say, the engine C functions.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest