Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Tut] How to improve/fix right peak.

Experienced Elementalist
Joined
May 28, 2017
Messages
225
Reaction score
127
Deleted Post, because of the rason I get only dislikes and yeah duck off ragezone I never will help you again!

Good luck for all script Kiddis here on ragezone you guys are to retarded to do anything!
 
Last edited:
Junior Spellweaver
Joined
Apr 2, 2016
Messages
120
Reaction score
76
What is right peak ? Do you have any screen of video ?
 
Joined
Aug 14, 2009
Messages
2,304
Reaction score
1,189
Posted is posted. Removing a post just because you don't the attitude of ppl is a penis move. Either way google cache could "restore" your post regardless.. Sooo:

Post restored:
Hello Ragezone,

Today Im going to show you how to improve/fix Ducking right peak I mean its a simple methode to fix it and btw its not really a fix but it improves your problem, because right peak sucks....

Whatever lets start:


Search for:

// check muzzle block except when using scope


Important now! What we gonna change is this function:


Code:
isMuzzlerBlocked();


for you it should be this here:

Code:
isMuzzlerBlocked(this, GetMuzzlerPosition())

just replace it to:

Code:
isMuzzlerBlocked(this, GetHeadPosition(), GetMuzzlerPosition())

so your line should looks like:

Code:
if(!m_isInScope && wpn->getCategory()!=storecat_MELEE && isMuzzlerBlocked(this, GetHeadPosition(), GetMuzzlerPosition()))

now we are going to change the function but of the reason that I am to lazy to show you what you have exactly to change will I post the whole function here:

What Im going to do for you is to show you where I exactly changed something, its green markered.
Just copy pasta and everything should be done.

Code:
[COLOR=#00ff00]static bool isMuzzlerBlocked(obj_Player* pl, const r3dPoint3D& HeadPos, const r3dPoint3D& muzzlePos)[/COLOR]
{
// check if muzzler is visible, and if not (inside of wall) then we do not shoot anything
bool muzzlerBlocked = false;
{
[COLOR=#00ff00] r3dVector temp = muzzlePos-HeadPos;[/COLOR]
float len = temp.Length();
temp.Normalize();
if(len > 0)
{
PxRaycastHit hit;
PxSceneQueryFilterData filter(PxFilterData(COLLIDABLE_STATIC_MASK,0,0,0), PxSceneQueryFilterFlags(PxSceneQueryFilterFlag::eDYNAMIC|PxSceneQueryFilterFlag::eSTATIC));
muzzlerBlocked = g_pPhysicsWorld->raycastSingle( PxVec3[COLOR=#00ff00](HeadPos.x,HeadPos.y,HeadPos.z[/COLOR]), PxVec3(temp.x, temp.y, temp.z), len, PxSceneQueryFlags(PxSceneQueryFlag::eIMPACT), hit, filter);
}
}
if(muzzlerBlocked)
return true;

const float MAX_CASTING_DISTANCE = 20000.f;
r3dPoint3D dir;
if(pl->m_isInScope || g_camera_mode->GetInt() != 1)
r3dScreenTo3D(r3dRenderer->ScreenW2, r3dRenderer->ScreenH2, &dir);
else
r3dScreenTo3D(r3dRenderer->ScreenW2, r3dRenderer->ScreenH*0.32f, &dir);

// check if camera->shoot_target position agains camera->muzzler (disable shooting when close to wall, but looking at step edge)
[COLOR=#00ff00]float distToMuzzler = (HeadPos-muzzlePos).Length();[/COLOR]
{
PxRaycastHit hit;
PxSceneQueryFilterData filter(PxFilterData(COLLIDABLE_STATIC_MASK,0,0,0), PxSceneQueryFilterFlags(PxSceneQueryFilterFlag::eDYNAMIC|PxSceneQueryFilterFlag::eSTATIC));
if(g_pPhysicsWorld->raycastSingle(PxVec3([COLOR=#00ff00]HeadPos.x, HeadPos.y, HeadPos.z[/COLOR]), PxVec3(dir.x, dir.y, dir.z), MAX_CASTING_DISTANCE, PxSceneQueryFlags(PxSceneQueryFlag::eDISTANCE), hit, filter))
{
if(hit.distance < distToMuzzler)
{
// shooting blocked before muzzler
return true;
}
}
}

return false;
}
 
Last edited:
Back
Top