Sign in to follow this  
Followers 0
Kavawuvi

(Dynamic) object rotation?

17 posts in this topic

Apparently there are two coordinates. Phasor mislabels the second as "scale".
 

Did you fix it?
I think you're looking at quaternions. Which parameters are you looking at, and, it's of a map, right?


These coordinates are not in the map. In the map, they use Yaw/Pitch/Roll as one coordinate in the scenario tag. What I'm looking at is what a dynamic object looks like. It's two coordinates that are on the circumference of a sphere that has a radius of 1.

 

Here's what an object's struct looks like in Halo's memory. All objects start with this:

 

typedef struct {

    TagID tagIdentity;                          //0x0

    char unknown0[0x58];                        //0x4

    Vector location;                            //0x5C

    Vector acceleration;                        //0x68

    Vector rotation1;                           //0x74

    Vector rotation2;                           //0x80

    char unknown1[0xC];                         //0x8C

    char unknown2[0x20];                        //0x98

    uint16_t team;                              //0xB8

    uint16_t unknown7;                          //0xBA

    char unknown3[0x8];                         //0xBC

    uint32_t player;                            //0xC4

    ObjectID owner;                             //0xC8

    char unknown4[0xC];                         //0xCC

    float maxHealth;                            //0xD8

    float maxShield;                            //0xDC

    float health;                               //0xE0

    float shield;                               //0xE4

    char unknown5[0x1C];                        //0xE8

    uint32_t shieldsRechargeDelay;              //0x104

    char unknown6[0x10];                        //0x108

    ObjectID heldWeaponIndex;                   //0x118

    ObjectID vehicleIndex;                      //0x11C

    uint32_t vehicleSeat;                       //0x120

} __attribute__((packed)) BaseObject;           //0x124

 

We're looking at rotation1 and rotation2. Vector is three floats x/y/z.

Edited by 002

Share this post


Link to post
Share on other sites

Tiddy-bits:

Maybe orientation and angular velocity. I'd expect object orientation to be quaternion though. 

If they are points on a sphere of radius 1, and not 4 floats, they might be direction vectors. 

euclideanspace.com has code for conversion of rotation types if you need that for your UI.

Vector to euler is what I did with the sky tag direction calculator. It uses marker position as a direction vector, and yields euler angles. 

Share this post


Link to post
Share on other sites

You could just look in my HUD source code for vehicles on radar.

float rvx = readFloat(pointer+0x74);
float rvy = readFloat(pointer+0x78);
float rvz = readFloat(pointer+0x7C);
                        
radian = acos(rvx/sqrt(1 - pow(rvz, 2)));
if (rvy > 0) radian=2*M_PI - radian;

(For the rotation in radians if you were looking from above)

NeX and Chronocide like this

Share this post


Link to post
Share on other sites

Did you ever figure it out?

EDIT:

Nevermind, someone on stackoverflow.com helped me.

function rotate(X, Y, alpha)
    local c, s = math.cos(math.rad(alpha)), math.sin(math.rad(alpha))
    local t1, t2, t3 = X[1]*s, X[2]*s, X[3]*s
    X[1], X[2], X[3] = X[1]*c+Y[1]*s, X[2]*c+Y[2]*s, X[3]*c+Y[3]*s
    Y[1], Y[2], Y[3] = Y[1]*c-t1, Y[2]*c-t2, Y[3]*c-t3
end

function convert(Yaw, Pitch, Roll)
    local F, L, T = {1,0,0}, {0,1,0}, {0,0,1}
    rotate(F, L, Yaw)
    rotate(F, T, Pitch)
    rotate(T, L, Roll)
    return {F[1], -L[1], -T[1], -F[3], L[3], T[3]}
end 
Edited by Yusuke
WaeV likes this

Share this post


Link to post
Share on other sites

Did you ever figure it out?

EDIT:

Nevermind, someone on stackoverflow.com helped me.

 

function rotate(X, Y, alpha)
    local c, s = math.cos(math.rad(alpha)), math.sin(math.rad(alpha))
    local t1, t2, t3 = X[1]*s, X[2]*s, X[3]*s
    X[1], X[2], X[3] = X[1]*c+Y[1]*s, X[2]*c+Y[2]*s, X[3]*c+Y[3]*s
    Y[1], Y[2], Y[3] = Y[1]*c-t1, Y[2]*c-t2, Y[3]*c-t3
end

function convert(Yaw, Pitch, Roll)
    local F, L, T = {1,0,0}, {0,1,0}, {0,0,1}
    rotate(F, L, Yaw)
    rotate(F, T, Pitch)
    rotate(T, L, Roll)
    return {F[1], -L[1], -T[1], -F[3], L[3], T[3]}
end 

A long time ago, actually. I'll have to test if this works, actually...

NeX likes this

Share this post


Link to post
Share on other sites

-snip-

Yuck, use code tags! Did you color that by hand?

typedef struct {
    TagID tagIdentity;                          //0x0
    char unknown0[0x58];                        //0x4
    Vector location;                            //0x5C
    Vector acceleration;                        //0x68
    Vector rotation1;                           //0x74
    Vector rotation2;                           //0x80
    char unknown1[0xC];                         //0x8C
    char unknown2[0x20];                        //0x98
    uint16_t team;                              //0xB8
    uint16_t unknown7;                          //0xBA
    char unknown3[0x8];                         //0xBC
    uint32_t player;                            //0xC4
    ObjectID owner;                             //0xC8
    char unknown4[0xC];                         //0xCC
    float maxHealth;                            //0xD8
    float maxShield;                            //0xDC
    float health;                               //0xE0
    float shield;                               //0xE4
    char unknown5[0x1C];                        //0xE8
    uint32_t shieldsRechargeDelay;              //0x104
    char unknown6[0x10];                        //0x108
    ObjectID heldWeaponIndex;                   //0x118
    ObjectID vehicleIndex;                      //0x11C
    uint32_t vehicleSeat;                       //0x120
} __attribute__((packed)) BaseObject;           //0x124
Samuco likes this

Share this post


Link to post
Share on other sites

Yuck, use code tags! Did you color that by hand?

 

No, and you're commenting on a post that was made over 14 months ago. I've been using code tags since then. Also, line numbers aren't always necessary, and they're broken if the first line is an even number.

NeX likes this

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0
  • Recently Browsing   0 members

    No registered users viewing this page.