#I figured it out, actually ... the

1 messages · Page 1 of 1 (latest)

coral spade
#

Oh interesting! What did you do? If you don't mind sharing. I would love to see how you did things, maybe I can make mine more efficient or easier to use. This is what I'm doing. I'm using mine when you a player walks into a trigger, which I'm using as a checkpoint for an orienteering course. It pulls the name of the trigger entity from the trigger's OnActivate, and then I'm pulling the name of the next trigger (next checkpoint) to give a compass heading in degrees and a distance in meters. I think the vector.Direction is the secret sauce.

float GetNextCheckpointHeading(string currentCheckpoint, string nextCheckpoint)
    {
        BA_SpawnerEntity calc = BA_SpawnerEntity.Cast(GetGame().GetWorld().FindEntityByName("BA_Spawner"));
        vector currentCpPos = calc.GetEntityPosition(currentCheckpoint);
        vector nextCpPos = calc.GetEntityPosition(nextCheckpoint);
        vector direction = vector.Direction(currentCpPos, nextCpPos);
        direction = direction.VectorToAngles();
        float heading = direction[0];
        heading = Math.Round(heading);
        return heading;
    }
oblique breach
#
    {
        vector transform[4];
        world.GetCurrentCamera(transform);
        float yaw = Math3D.MatrixToAngles(transform)[0];
        if (yaw < 0) {yaw = 360 - Math.AbsFloat(yaw);}
        return Math.Round(yaw);
    }    ```