#Ai get rotation help
27 messages · Page 1 of 1 (latest)
I believe there was a way to do this by getting their position, and comparing it to their position on the next tick.
Also why did you delete your original message? I see people do that alot and it bugs me, you can just edit it if you got something wrong in it.
Because i first needed to make a pathfinding system but i figured it out now i need the rotation
To get the rotation as a quaternion of a Player or Rec Room Object, you can use the "Get Rotation" chip.
Using your makerpen, spawn in a "Add Tag" chip, a "Rec Room Object Get First With Tag" chip, and a "Get Rotation" chip. In your makerpen menu, select the "Connect" tool. Connect the "Exec" output labelled "Object Spawned" on your Spawner Component's object board to the "Exec" input on the "Add Tag" chip. Connect the "Rec Room Object" output labelled "Object" on your Spawner Component's object board to the "Rec Room Object" input labelled "Target" on the "Add Tag" chip. Using the "Connect" or "Configure" tool in your makerpen menu, select the "String" input labelled "Tag" on the "Add Tag" chip, and configure it to be "AI", or something similar (I will refer to this value you inputted into the "Add Tag" chip as "AI"). Using the "Connect" or "Configure" tool in your makerpen menu, select the "String" input labelled "Tag" on the "Rec Room Object Get First With Tag" chip, and configure it to be "AI". Using the "Connect" tool in your makerpen menu, connect the "Rec Room Object" output labelled "Object" to the "Rec Room Object | Player" input labelled "Target" on the "Get Rotation" chip.
The "Quaternion" output labelled "Quaternion" on the "Get Rotation" chip is the rotation of the earliest currently existing object spawned by your Spawner Component as a Quaternion.
You may wish to spawn multiple objects with the Spawner Component and get each of their rotations separately. To do so, you can replace the "Rec Room Object Get First With Tag" with a "Rec Room Object Get All With Tag", connect the "List<Rec Room Object>" output labelled "Objects With Tag" to the "List<Any>" input labelled "List" on a "List Get Element" chip, and connect the "Rec Room Object" (previously "Any") output labelled "Value" on the "List Get Element" chip to the "Rec Room Object | Player" input labelled "Target" on the "Get Rotation" chip.
hold on I'm not sure if this works on AI
iirc it always outputs the same direction
no matter where it's actually looking
might be fixed, but knowing rec room's attention to AI, it probably isn't
(Continued × 1) The "Int" input labelled "Index" on the "List Get Element" chip is the index of the object in the list of currently existing objects spawned by the Spawner Component that you wish to get the rotation for. However, instead of this, you can also give each of the spawned object a unique tag, and get the rotation of a specific tag (feel free to ask if you need help setting up such a system).
Let me know if this helps.
Is this a bug?
@brazen thistle currently you cannot get the rotation of an AI, its a bug
But i want to track one ai goblin is it hard to do?
I believe you can still use combatant get ground position chips though and save the value each tick, subtracting it from the unsaved value of the next tick before setting it again to get the direction they are moving, which will also be the direction they are facing since the AI don't really turn just their heads but rather their whole body
Just make sure the exec runs through the vector variable chip after you've done everything you need to with the saved and unsaved vectors.
Okie
you can just use combatant get velocity
Make sure that the Vector3 variable is normalized before it is used as a direction.
oh no, don't tell me that's a thing 🤦♂️