Results 1 to 6 of 6

Thread: Simulate spectator leaning

  1. #1

    Question Simulate spectator leaning

    Problem: In version of Specplayer mod which I'm doing now with EventSystem Engine everything is working perfectly as far as I tested without one thing: I need my camera to simulate movement of view when player is leaning like in default spectator. Currently my version is lacking it, so when player lean camera stays in one place. One of proposition was to change admin head position according to suspects bones, with checking like here, but since its camera, not admin glued as ghost to supsect, what should move, I think it doesn't make sense.

    I need any propositions of solving that problem, discussion, pointers, not fully done for me code, maybe I will learn something.
    Github - Steam - .Crimewavez#5285

  2. #2
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,603

    Default

    You can test suspect angles(remember the angles thing I told ya about) and decide if he's leaning right or left based on them. Then you can stufftext "+/-leanright/left" onthe spectator to simulate such leaning.
    James should know more about this, since he did antistwh and had to check for leaning a lot, or RR idr tbh.

  3. #3
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    My initial fix was via script and yes I was checking leaning. In fact I remember we had a discussion on leaning in Discord, and I posted several threads that were what you were looking for.
    Basically when you lean it's a float value that is 0 -> 1 (if I remember correctly) or -1 -> 0 if you lean in the other way. I can't remember if the value were 1 or up to 16.. -16 <-- 0 --> 16

    The way RR fixed it in the antiSTWH, was instead of checking leaning, we checked the gunmuzzleposition and check if it "collides" with a wall. If it does, we set bulletAttack to 0 so the bullet is fired, but doesn't do any damage.

    vec3_t start;
    vec3_t mins = { -4, -4, 0};
    vec3_t maxs = { 4, 4, 6 };


    //we add + 2.0f to x and y axis to prevent back of player model to collide with doorway or walls
    //also for z value we use centroid to prevent from false positives when players foot falls a bit under ground


    start[0] = ent->absmin[0] + 2.0f;
    start[1]= ent->absmin[1] + 2.0f;
    start[2] = ent->centroid[2];


    //Now we do a trace
    gi.trace(&res, start, mins, maxs, pos, ent->s.number, MASK_SOLID, 0, 0);


    if(res.fraction != 1.0f && res.surfaceFlags != 0x108B0) // we make sure that surface isn't a GLASS? Windows have this value
    {
    gi.Printf("Reborn Patch: STWH Detected! Skipping BulletAttack!\n");
    return 0;
    }
    else
    {
    //return CanShoot_orig(emptyWeaponStructPointer, somevalue, varInsideCurrentWeaponPointer, currentWeaponStructPointer);
    return 1;
    }

  4. #4

    Default

    making the spectator to lean won't work if he is using a camera. and i'm not sure, but i don't think is possible to emulate the leaning with a camera
    the easy way would be to get rid of the camera, glue the spectator and make the leaning via stufftext as ryback said, but, the contra is that the view won't be as smooth as using a camera

  5. #5

    Default

    You can test suspect angles(remember the angles thing I told ya about) and decide if he's leaning right or left based on them. Then you can stufftext "+/-leanright/left" onthe spectator to simulate such leaning.
    Camera doesn't care about things like that, it's affecting only player bodies.

    and i'm not sure, but i don't think is possible to emulate the leaning with a camera
    It's not, I even checked and scripted all propositions to check if my thinking is retarded again, but no. No matter then, thanks for help, I will leave it as is, in FT people doesn't have problems with spoting cheaters while being freezed, so if someone isn't severely blind he will not have problem with spectating mod.
    Github - Steam - .Crimewavez#5285

  6. #6
    Über Prodigy & Developer Razo[R]apiD's Avatar
    Join Date
    May 2010
    Location
    Poland, Lublin
    Posts
    3,257

    Default

    Based on the thread you posted you should be able to get viewangles of the spectated player with:

    local.spectatedPlayer.viewangles

    where local.spectatedPlayer is Player entity

    Then you need to adjust the camera position and rotation based on those angles

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •