This site has been archived and made available for preservation purposes. No edits can be made.

Results 1 to 4 of 4

Thread: Synchronization math

  1. #1
    Administrator
    Join Date
    Jun 2011
    Location
    Germany
    Posts
    1,057
    Blog Entries
    5

    Synchronization math

    Maybe you know about the math formula I'm looking for to work on some sync issues. The main problem is the following:

    Actual state (information) of position, animation etc. is perfectly synced. However, there is a game lag when applying animation groups on a player, which often leads to situations as illustrated below:

    sync.png

    (this is the simplest case, there are more problematic ones)

    I'm looking for the correct math required to find the mentioned "angle fix", based on the following:

    input:

    in-game position (X, Y, Z, angles)
    destination position (X, Y, Z)
    last running animation (and the direction of it)

    output:

    a Z-angle delta to apply on the current Z-angle, which when running animation is kept, will make the player reach the destination.

    Help appreciated. It's some trickery with vectors.
    Last edited by foxtacles; 05-03-2012 at 11:22 PM.

  2. #2
    well this is why im never gonna be a good network programmer haha :P, im gonna stick strictly to what i know, but is there someway you could just trigger the animation when the a key is pressed like "walking=true" then just when they let go of the key "walking=0"? or am i completely missing the point (as i said i never program anything to do with networks), because if you could do something like that im sure it wouldnt cause to much lag to pass a single boolean varible
    Last edited by jam; 05-04-2012 at 01:25 AM.

  3. #3
    Looks interesting. Unfortunately it's 3am and I've been up all night watching local council elections, so I'm a tad too tired to think right now. I'll have a look when I'm a bit more awake.

  4. #4
    I already sent the answer to the mail of Recycler, but i also post there for sharing:

    float rotation=(atan2(y1 - y2, x1 - x2)) * 180 / PI;

    Maybe the rotation also needs an offset, depending on how the game is implemented

Posting Permissions

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