Actor direction menu

User Tag List

Results 1 to 8 of 8
  1. #1
    CrEEzz's Avatar Active Member
    Reputation
    66
    Join Date
    Jan 2014
    Posts
    153
    Thanks G/R
    10/40
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Actor direction

    There are acd.x0C8_Direction and acd.x0CC_Direction. However it doesn't seem to fit Vec2D describing actor direction in world. Anyone found out how it can be of use? Or is there actor direction somewhere else?

    Actor direction
  2. #2
    enigma32's Avatar Legendary
    Reputation
    912
    Join Date
    Jan 2013
    Posts
    551
    Thanks G/R
    4/738
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    bastiflew's Avatar Active Member
    Reputation
    41
    Join Date
    Aug 2012
    Posts
    98
    Thanks G/R
    1/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've coded few Wallhack / aimbot, and with angle I always use Math.Atan2(vec2.x, vec2.y)
    And you've got the radian angle.

  4. #4
    CrEEzz's Avatar Active Member
    Reputation
    66
    Join Date
    Jan 2014
    Posts
    153
    Thanks G/R
    10/40
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I feel like I'm gonna make a fool of myself but I tried interpreting those two floats as spherical coordinates (for 3D vector), including reversed angles version:

    Code:
     // http://en.wikipedia.org/wiki/File:3D_Spherical.svg
    // theta is the angle between the positive Z-axis and the vector in question (0 ≤ θ ≤ π)
    // phi is the angle between the projection of the vector onto the X-Y-plane and the positive X-axis (0 ≤ φ < 2π)        
    public static Vec3 FromSpherical(float theta, float phi)
    {
        return new Vec3((float)(Math.Sin(theta) * Math.Cos(phi)), (float)(Math.Sin(theta) * Math.Sin(phi)), (float)Math.Cos(theta));
    }
    2D version (each one of them as radian):

    Code:
    public static Vec3 FromSpherical2D(float phi)
    {
        return new Vec3((float)Math.Cos(phi), (float)Math.Sin(phi), 0);
    }
    but none of those resulted in actor forward vector. Can you plz simply supply me code sample for converting those damned pair of floats to actor forward vector?
    Last edited by CrEEzz; 10-11-2014 at 10:08 PM.

  5. #5
    bastiflew's Avatar Active Member
    Reputation
    41
    Join Date
    Aug 2012
    Posts
    98
    Thanks G/R
    1/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know what mean "actor forward version" but angle works with this code :

    Code:
                var x = player.x0A0_Direction_Abs0to1;
                var y = player.x0A4_Direction_1toNeg1;
    
                var angle = Math.Atan2(x, y);
    The right bottom corner is 0°, left bottom 45°, etc...

    EDIT : May be I understant what you want, a Vec3 in x yards in direction of the actor :

    Code:
                var x = player.x0A0_Direction_Abs0to1;
                var y = player.x0A4_Direction_1toNeg1;
    
                var angle = Math.Atan2(x, y);
    
    //Vec3 is userDefined in my code
    // pos is the Vec3 of the actor
    // replace radius by the distance of the desired vec3
    
    var vecDirection = new Vec3(radius*(float) Math.Cos(angle) + pos.x, radius*(float) Math.Sin(angle) + pos.y, pos.z)
    Last edited by bastiflew; 10-11-2014 at 03:44 PM.

  6. #6
    CrEEzz's Avatar Active Member
    Reputation
    66
    Join Date
    Jan 2014
    Posts
    153
    Thanks G/R
    10/40
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I meant forward vector xD Thanks for hints, I finally sat down, displayed all those numbers and figured it out. This work for me.

    Code:
    float half_angle_cos = acd.x0CC_Direction; // -1 for X aligned, 1 for -X aligned, 0.7 for Y aligned, -0.7 for -Y aligned
    float radians = (float)Math.Acos(half_angle_cos) * 2;
    
    dir = new Vec3((float)Math.Cos(radians), (float)Math.Sin(radians), 0);

  7. #7
    axlrose's Avatar Member
    Reputation
    1
    Join Date
    May 2014
    Posts
    35
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The 3D rotations are given in quaternion form (XYZW, 4-dimensional vector with length 1.0). You can easily spot the rotations in the fields by finding 4 consecutive floats with a vector length of 1.0.

    @CrEEzz: Your example only works when there is Z rotation only (x00C_Direction). Take into account the neighbouring 3 fields in the acd (which should be XY and W). There are routines to convert quaternion to euler angles or rotation matrixes. Multiply Vec(1,0,0,0), which is "forward", onto the 4x4 rotation matrix and you'll get the correct results for all rotations.
    Last edited by axlrose; 10-14-2014 at 10:09 AM.

  8. #8
    CrEEzz's Avatar Active Member
    Reputation
    66
    Join Date
    Jan 2014
    Posts
    153
    Thanks G/R
    10/40
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It was some time, and I wanted to make final summary You were right axlrose. To obtain direction one have to do the following:

    Code:
    Quat q = new Quat(acd.x0C0_Direction, acd.x0C4_Direction, acd.x0C8_Direction, acd.x0CC_Direction); // quaternion(x,y,z,w)
    Vec3 dir = q * new Vec3(1, 0, 0);

Similar Threads

  1. idemise guide direct download
    By Zurkei in forum World of Warcraft Guides
    Replies: 12
    Last Post: 08-11-2007, 02:06 PM
  2. Post your Favorite Director/Producer/Actor here!
    By The Juggernaut in forum Community Chat
    Replies: 8
    Last Post: 03-20-2007, 02:46 PM
  3. Working on Movie,actors needed ^^
    By Raijin in forum World of Warcraft General
    Replies: 12
    Last Post: 11-08-2006, 07:53 AM
  4. Searching for Voice Actors/In-Game Actors
    By Örpheus in forum World of Warcraft General
    Replies: 1
    Last Post: 08-01-2006, 10:03 AM
  5. Direction <WoW Glider>
    By Kaladze in forum World of Warcraft General
    Replies: 5
    Last Post: 07-08-2006, 02:35 PM
All times are GMT -5. The time now is 01:29 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search