diff --git a/main.c b/main.c index c51f68d..bb08f70 100644 --- a/main.c +++ b/main.c @@ -1711,6 +1711,10 @@ void cause_action_side_effects(Entity *from, Action a) assert(to); } + if(to) + { + from->target_rotation = AngleOfV2(SubV2(to->pos, from->pos)); + } if(a.kind == ACT_join) { @@ -5911,6 +5915,8 @@ void frame(void) if(it->dialog_fade > 0.0f) it->dialog_fade -= dt/DIALOG_FADE_TIME; + it->rotation = lerp_angle(it->rotation, unwarped_dt*8.0f, it->target_rotation); + if (it->gen_request_id != 0 && !gs.stopped_time) { assert(it->gen_request_id > 0); diff --git a/makeprompt.h b/makeprompt.h index 5d5ba01..28b8e3f 100644 --- a/makeprompt.h +++ b/makeprompt.h @@ -229,6 +229,7 @@ typedef struct Entity // npcs NpcKind npc_kind; EntityRef joined; + float target_rotation; // turns towards this angle in conversation bool being_hovered; bool perceptions_dirty; float dialog_fade;