News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu

Pistol brass on wrong side

Started by calan, October 30, 2014, 02:49:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Phrozo

#15
I can't help with the model/bone stuff but here is something easy you can do with the code.

I'm not sure why this was done in the original code, but the ejected brass debris is having it's linear ( and also angular ) velocity forced to eject based on the player view axis after it is launched. This isn't necessary and prevents a negative y value for the vector being used which is needed to eject right.

From Weapon.cpp:
/*
================
idWeapon::Event_EjectBrass

Toss a shell model out from the breach if the bone is present
================
*/
void idWeapon::Event_EjectBrass( void ) {
if ( !g_showBrass.GetBool() || !owner->CanShowWeaponViewmodel() ) {
return;
}

if ( ejectJointView == INVALID_JOINT || !brassDict.GetNumKeyVals() ) {
return;
}

if ( gameLocal.isClient ) {
return;
}

idMat3 axis;
idVec3 origin, linear_velocity, angular_velocity;
idEntity *ent;

if ( !GetGlobalJointTransform( true, ejectJointView, origin, axis ) ) {
return;
}

gameLocal.SpawnEntityDef( brassDict, &ent, false );
if ( !ent || !ent->IsType( idDebris::Type ) ) {
gameLocal.Error( "'%s' is not an idDebris", weaponDef ? weaponDef->dict.GetString( "def_ejectBrass" ) : "def_ejectBrass" );
}
idDebris *debris = static_cast<idDebris *>(ent);
debris->Create( owner, origin, axis );
debris->Launch();

linear_velocity = 40 * ( playerViewAxis[0] + playerViewAxis[1] + playerViewAxis[2] );
angular_velocity.Set( 10 * gameLocal.random.CRandomFloat(), 10 * gameLocal.random.CRandomFloat(), 10 * gameLocal.random.CRandomFloat() );

debris->GetPhysics()->SetLinearVelocity( linear_velocity );
debris->GetPhysics()->SetAngularVelocity( angular_velocity );
}


Comment out this:

//linear_velocity = 40 * ( playerViewAxis[0] + playerViewAxis[1] + playerViewAxis[2] );
//angular_velocity.Set( 10 * gameLocal.random.CRandomFloat(), 10 * gameLocal.random.CRandomFloat(), 10 * gameLocal.random.CRandomFloat() );

//debris->GetPhysics()->SetLinearVelocity( linear_velocity );
//debris->GetPhysics()->SetAngularVelocity( angular_velocity );


After modifying the code, you can get the shotgun shell to eject right with one last change:

Change the y value to something negative for this vector being used in 'debris_shotgunbrass'
"velocity" "-25 -100 50"

I also tested this so it should work.

The Happy Friar

Thanks.  I was starting to think down that path.