Skip to content
Jan Boon edited this page Mar 12, 2023 · 4 revisions

title: Facing description: published: true date: 2023-03-12T14:12:53.959Z tags: editor: markdown dateCreated: 2023-03-12T14:12:53.959Z

facing

The facing native AI script function is used to change the orientation of an NPC to face a particular direction or another NPC.

Syntax

()facing(direction: f) // facing_f_
()facing(group1: c, botname1: s, group2: c, botname2: s) // facing_cscs_

Arguments

()facing(f)

  • direction (float): The new angle of the NPC in radians.

()facing(c, s, c, s)

  • group1 (context): The NPC group of the bot that will turn towards the other bot.
  • botname1 (string): The name of the bot that will turn.
  • group2 (context): The NPC group of the bot that the other bot will face.
  • botname2 (string): The name of the bot that the other bot will face.

Examples

Face a direction

()facing(3.14); 

This example code sets the orientation of the current NPC to 3.14 radians.

Turn towards another bot

(@group1)group_name1.context();
(@group1)group_name2.context();
()facing(@group1, "bob", @group2, "bobette");

This example code sets the orientation of the NPC named "bob" in group "group_name1" to face the NPC named "bobette" in group "group_name2".

Clone this wiki locally