Hi there,

I am currently following the ORK 3 RPG Playground tutorial and have been able to get interactions working. I'd like my NPC model to only rotate their head towards the player and I was wondering how I would accomplish this?

I can see in the schematics setup of the "Rotate To" node that you can define the Object and Child Object, would I reference the name of my joint here or do I need to do something else completely different in order to animate the joints?
  • I think something like this is usally done via a looking target in your animations - e.g. via a script or schematic.

    You can e.g. set up a Tick Machine on your game object's 'head' and use a target game object that's stored in selected data.
    E.g. using an Object Variables component on your NPC and setting the player (or a child object of the player) as target selected data, the tick machine's schematic would take care of rotating to it.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you for your reply!

    I'm a bit confused as to what selection I need to make for my selected data (The data key, etc) and where to put my Object ID. Here are my current settings for my NPC model and the schematic attached to the interaction machine on the NPC prefab.

    https://imgur.com/a/Fgz18df
  • You can set the Object Variables component to use Local Variables, object ID is only needed if you want to save or share the variables between game objects.

    The node accessing it just needs to use the Object data origin and use the game object that has the component (e.g. the Machine Object if the schematic is running via a machine on the game object).
    Also, the Rotating Object would be the machine object, the object you rotate to the one in selected data.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Hi Gil,

    Thank you for you help, I was able to get things working and now the head moves when the player interacts.

    Also, is it possible to restrict certain degrees of movement similar to Lock Rotation in the Rotate To node? E.G The player talks to the NPC from behind, and the head only rotates slightly so it doesn't look unnatural.
  • You can e.g. use a Check Orientation or Orientation Fork node to see if the player is behind the NPC and limit the rotation based on that (e.g. instead of Rotate To use a different rotation node to rotate by some degree).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Got that working too, thank you!
Sign In or Register to comment.