1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-28 19:25:27 +00:00

Small Math_Vec3f_Yaw doc (#1433)

* Small `Math_Vec3f_Yaw` doc

* remove actor from arg names

---------

Co-authored-by: fig02 <fig02srl@gmail.com>
This commit is contained in:
Dragorn421 2024-01-18 23:56:54 +01:00 committed by GitHub
parent 90a6268460
commit 5e406f754e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 14 deletions

View file

@ -354,8 +354,9 @@ void Actor_MoveXZGravity(Actor* actor);
void Actor_UpdateVelocityXYZ(Actor* actor);
void Actor_MoveXYZ(Actor* actor);
void Actor_SetProjectileSpeed(Actor* actor, f32 speedXYZ);
s16 Actor_WorldYawTowardActor(Actor* actorA, Actor* actorB);
s16 Actor_WorldYawTowardPoint(Actor* actor, Vec3f* refPoint);
s16 Actor_WorldYawTowardActor(Actor* origin, Actor* target);
s16 Actor_FocusYawTowardActor(Actor* origin, Actor* target);
s16 Actor_WorldYawTowardPoint(Actor* origin, Vec3f* point);
f32 Actor_WorldDistXYZToActor(Actor* actorA, Actor* actorB);
f32 Actor_WorldDistXYZToPoint(Actor* actor, Vec3f* refPoint);
s16 Actor_WorldPitchTowardActor(Actor* actorA, Actor* actorB);
@ -856,7 +857,7 @@ void Math_Vec3f_Scale(Vec3f* vec, f32 scaleF);
f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b);
f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* dest);
f32 Math_Vec3f_DistXZ(Vec3f* a, Vec3f* b);
s16 Math_Vec3f_Yaw(Vec3f* a, Vec3f* b);
s16 Math_Vec3f_Yaw(Vec3f* origin, Vec3f* point);
s16 Math_Vec3f_Pitch(Vec3f* a, Vec3f* b);
void Actor_ProcessInitChain(Actor* actor, InitChainEntry* ichain);
f32 Math_SmoothStepToF(f32* pValue, f32 target, f32 fraction, f32 step, f32 minStep);

View file

@ -915,16 +915,25 @@ void Actor_UpdatePosByAnimation(Actor* actor, SkelAnime* skelAnime) {
actor->world.pos.z += posDiff.z * actor->scale.z;
}
s16 Actor_WorldYawTowardActor(Actor* actorA, Actor* actorB) {
return Math_Vec3f_Yaw(&actorA->world.pos, &actorB->world.pos);
/**
* @return Yaw towards `target` for `origin`, using world positions.
*/
s16 Actor_WorldYawTowardActor(Actor* origin, Actor* target) {
return Math_Vec3f_Yaw(&origin->world.pos, &target->world.pos);
}
s16 Actor_FocusYawTowardActor(Actor* actorA, Actor* actorB) {
return Math_Vec3f_Yaw(&actorA->focus.pos, &actorB->focus.pos);
/**
* @return Yaw towards `target` for `origin`, using focus positions.
*/
s16 Actor_FocusYawTowardActor(Actor* origin, Actor* target) {
return Math_Vec3f_Yaw(&origin->focus.pos, &target->focus.pos);
}
s16 Actor_WorldYawTowardPoint(Actor* actor, Vec3f* refPoint) {
return Math_Vec3f_Yaw(&actor->world.pos, refPoint);
/**
* @return Yaw towards `point` for `origin`.
*/
s16 Actor_WorldYawTowardPoint(Actor* origin, Vec3f* point) {
return Math_Vec3f_Yaw(&origin->world.pos, point);
}
s16 Actor_WorldPitchTowardActor(Actor* actorA, Actor* actorB) {

View file

@ -300,9 +300,14 @@ f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b) {
return b->y - a->y;
}
s16 Math_Vec3f_Yaw(Vec3f* a, Vec3f* b) {
f32 dx = b->x - a->x;
f32 dz = b->z - a->z;
/**
* @param origin Position of the origin, the location from which to look at the target `point`
* @param point Position of the target point, in the same space as `origin`
* @return The yaw towards `point` when at `origin`, assuming +z is forwards.
*/
s16 Math_Vec3f_Yaw(Vec3f* origin, Vec3f* point) {
f32 dx = point->x - origin->x;
f32 dz = point->z - origin->z;
return Math_Atan2S(dz, dx);
}

View file

@ -20,8 +20,11 @@ Vec3f OnePointCutscene_AddVecGeoToVec3f(Vec3f* a, VecGeo* geo) {
return sum;
}
s16 OnePointCutscene_Vec3fYaw(Vec3f* vec1, Vec3f* vec2) {
return CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(vec2->x - vec1->x, vec2->z - vec1->z)));
/**
* @see Math_Vec3f_Yaw
*/
s16 OnePointCutscene_Vec3fYaw(Vec3f* origin, Vec3f* point) {
return CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(point->x - origin->x, point->z - origin->z)));
}
void OnePointCutscene_Vec3sToVec3f(Vec3f* src, Vec3s* dst) {