Announcement

Collapse
No announcement yet.

Determining the direction the player is moving

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dutch
    replied
    @gypsy

    Thanks for the heads up, I had no idea...you'd think after 4 years I would've figured that out by now lol

    Leave a comment:


  • Bloodshot
    replied
    Wow, thanks for the quick responses, I sorta got it working with comparisons to v_forward and a negative value. I just gotta figure out how to compare to v_right so moving diagonally backwards doesn't make the player point forward, I'll play around with it more, and if i have any questions post in here.

    Leave a comment:


  • MadGypsy
    replied
    Off Topic

    @ Dutch - if you didn't know (maybe you did) you can link directly to that post.

    right click "permalink" in the uppermost right corner of the box for the post and select "copy link target" or whatever comparable option your browser provides. Then simply paste that link.

    Leave a comment:


  • Dutch
    replied
    To compare two different vectors, you'll want to use the dot product. It is explained fairly well in this thread here:

    http://quakeone.com/forums/quake-hel...t-product.html

    To see an example of it in a way closer to your idea, spike gave me some good advice back in the day. Read post #270 on this thread:

    http://quakeone.com/forums/quake-mod...tquake-27.html

    Leave a comment:


  • Spike
    replied
    behold the power of dotproducts!
    makevectors(self.v_angle); // might have already been done recently enough.
    forward = self.velocity*v_forward;
    right = self.velocity*v_right;
    up = self.velocity*v_up;

    beware of sudden changes when running into walls.

    Leave a comment:


  • Bloodshot
    started a topic Determining the direction the player is moving

    Determining the direction the player is moving

    Hey guys, it's been a while since i've asked for help on here, but I'm working on changing up animations and I have a question about angles.

    Right now I have a basic change to make the 3rd person cam look more natural, right now I'm using

    Code:
     vector pang;
     pang = vectoangles(self.velocity);
    And passing that into the _y of the player entity angle to make the player model look in the direction you move, combined with jump and swim anims it really helps.

    I was wondering if there's a way to detect the direction you are moving relative to the player? v_right moves things based on the player camera, but AFAIK there's no way to check if the player is moving in the direction of v_right or -v_right correct? At least I couldn't figure out a way to test the velocity against it. The problem with using velocity directly is that left and right are always a different value based on the player's facing.

    Basically I want to see what direction the player is moving and play unique animations accordingly.
    Last edited by Bloodshot; 06-02-2017, 12:13 PM.
Working...
X