News Forums RAIN Sample Projects, How To, and Code How to control the player

This topic contains 2 replies, has 2 voices, and was last updated by  PROGYS 6 months, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34896

    PROGYS
    Participant

    Hi,
    I am sorry but I tried to find my answer with the asset “Squad Command-Advanced Warfighter AI”. I am looking to handle the Player moving, I know this may be a stupid question. But How can I use the controller for the player ,like with this asset.
    I had already my own code, but I beleive RAIN can handle that better than me !
    I google it but nothing, just talking about the AI !

    thank you !

    #34899

    prime
    Keymaster

    Typically an AI will move by first determining a “move to” target location, then calculating a path to the location, and finally translating its position over time through the waypoints that make up the path. In the Behavior Tree this is often a custom action for choosing a location followed by a Move node.

    Typically a human controlled character will move by just responding to a direct input (like go left or go right).

    You can make human controlled characters respond more like AI (for example, staying on the mesh) by taking the direct input and using it to define move targets. Then use regular AI logic to perform movement. Your Behavior Tree would be very similar to the AI behavior tree, with a custom action that defines a move target based on the player input (usually the player position plus some offset) followed by a Move node.

    This is essentially the approach we took with Squad Command. If you are using joystick or AWSD movement, then you probably want to turn off NavMesh movement - you don’t actually want the player control to try to follow a path. If you are using click to move controls, then you may want to leave NavMesh movement on. You can turn off NavMesh movement by setting the GraphTag of the player AI’s Navigator to a value that doesn’t match any NavMeshes (e.g., “no-nav-mesh”).

    #34904

    PROGYS
    Participant

    Thank you for your answer !

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.