Solved Vectors and Directions

Discussion in 'Plugin Development' started by AdraliK, Aug 7, 2018.

Thread Status:
Not open for further replies.
  1. Offline

    AdraliK

    I do not know how to calculate the vector and bind to them effects, fireball, etc. I looked at a lot of instructions, but I did not understand ((
    And how to make a vector straight with fire effects??
     
  2. Offline

    Zombie_Striker

    Well, all vectors are technically straight, as they represent a direction.

    What are you trying to achieve?
     
  3. Offline

    AdraliK

    I'm trying to do something like that in the QuakeWar, the same effect of the shot
     
  4. Offline

    Orcane

    A slick way to adjust points in 3D space is to use transformation matrices.

    When you multiply a 3D point by a translation matrix, it'll move it in any of the 4 directions based on the matrix.

    For example:
    Code:
    |1, 0, 0, 3|   | 5|   | 6|
    |0, 1, 0, 4|   |10|   |12|
    |0, 0, 1, 5|   |15|   |18|
    |0, 0, 0, 1| * | 1| = | 0|
    The 4x4 matrix is the translation matrix (xt=3, yt=4, zt=5), the 1x4 matrix would be the coordinate that's been translated (x=5, y=12, z=18) and the result, is what you would imagine, the coordinate with the applied translations.

    To draw a straight line in 3D space, you can create a translation matrix, determine a starting location, then inside a loop, play a particle effect at said location and multiply the location by the matrix.

    There are also rotation matrices, that you can do some pretty fun things with.
     
  5. Offline

    Orcane

    Sure, however I think using matrices are more helpful in the long run, as you can do more powerful things with them later on.
     
  6. @Orcane
    Sure, you can do advanced things with matrices, but there's no need to overcomplicate a problem. Using translation matrices is stupid in this case, not just because matrix multiplication is a bit difficult, but also because Bukkit has such nice support for adding and multiplying vectors. Look at the thread I linked, you cannot say that that is not simpler compared to using a matrix.
     
  7. Offline

    Orcane

    I'm not going to argue what's the best way to solve a problem, each to their own I guess.
     
  8. Offline

    AdraliK

    Thanks
     
Thread Status:
Not open for further replies.

Share This Page