Forum rules - please read before posting.

Motion Controller (ootii) will not "Turn To Face"

Hi, I have been using ootii's rather fabulous motion controller with AC with generally good results. However, since AC is relinquishing animation control, I can no longer get my character to face the direction I want with the "Turn to" command. Neither body or face turning works any more.

I'm not entirely sure how to tackle this, is there something I need to set up in AC, do I need to create custom motions in MC or is the answer a bit of both?

Any help would be greatly appreciated.

Comments

  • By "Turn to", do you mean the Character: Face object Action, or the Turn To Face / Face after moving options in a Hotspot interaction?

    You should generally be always able to read the intended character rotation with the Char script's GetTargetRotation function.  If you're reading it and it's not returning the correct value, it may be a bug.
  • Hi Chris,

    I mean both. If I put the Character: Face object action before a dialog for example; nothing happens until I manually turn to face the object myself.

    It's as if AC is trying to do what I ask and is getting feedback on the target rotation but is not able to rotate the character itself.

  • And what is your character's Motion control setting set to?  It it's set to Manual, then AC won't do any rotation itself - it'll rely on your own script.
  • Ah, hmm, is this where i need to dip into creating my own action?
  • You're already writing your own integration script between AC and Motion Controller.  Actions are only necessary if you want to trigger code as part of your game's Cutscenes / ActionLists.
  • Just in case anyone else comes across this post, I thought I'd log my progress.

    I have had some success with IK head turning,... wow that was easy... just make sure you have IK on the base layer and pow! 

    However, getting the character to turn with body is my big problem since ootii's controller doesn't have a discreet "Turn" Parameter.

    I'm going to try implementing my own state and hope it doesn't break the controller.


  • edited July 2016
    SecretAnorak / ChrisIceBox:

    I'm facing similar issues with turning ( turning being that I click on a Hotspot, the player walks over to the area of the Marker and I have "Face after moving" selected )

    My motion control setting is set to Manual.

    It allows me to highlight the hotspot. Player walks over to the Marker and then just stands there, doing nothing. My guess would be AC is waiting for the Player to be turned before it moves on. What would I need to do in code to make this happen?

    On a side note, my Camera's seem to be off when using Motion Controller also, like the target for them is not pointed correctly. Note that both Motion control settings are set to Custom and Manual.

    The video shows the system playing with a default AC controlled Player. Notice the camera and when clicking the Hotspot.



    Then, I click Player 4 to be default. This is the ootii Motion Controller with both Motion control settings set to Custom and Manual. Notice how the camera now points to different objects and when you get control of the Player, the camera is not how it was in the AC version.

    Last, I just need some advice on how to turn the player once they have reached the Marker.

    Using AC 1.52, Unity Pro 5.3.4f1, Windows 10
  • @matrix211v1: Without knowing how you've implemented the integration it's hard for me to say, re: the turning.  It seems to work when moving around the scene under player control, however.  Have you tried setting Motion control to Just Turning?

    Re: the camera issue - are those cameras affected by the player?  Are they parented to it, or have the player as their target?  If not, the player prefab shouldn't be affecting their position.
  • edited July 2016
    ChrisIceBox:

    re: the turning
    I only used the code in the tutorial found at http://www.adventurecreator.org/tutorials/adding-custom-motion-controller 
    No additional code has been added. When I set it to Just Turning, no matter what value I put in for the Turning speed ( 0.1 to 1000) nor clicking the Turn before walking on or off, the player either walks sideways, backwards and sometimes forwards. I think there must be a setting in the Actor Controller of ootii to turn it off so it's not fighting AC but I have not figured it out. The good news is that when Motion control is set to Just Turning, I can click on my Hotspots, which is a plus!

    Re: the camera issue
    The game begins with a Cutscene in which the first camera that is used is a GameCameraThirdPerson and the target is the player. That is used until I do a Camera Switch, which is pointed at the Ogre, then another Camera Switch using Smooth of 2 seconds that zooms up to the Ogres face. A few more camera switches, which are not parented to the player nor the Ogre and then back to the GameCameraThirdPerson. All this is happening in one Cutscene.

    On a side note, I get this in the editor:
    Player clone found in scene - this may have been hidden by a Unity bug, and has been destroyed.

    -----------------------------
    UnityEngine.Debug:LogWarning(Object, Object)
    AC.ACDebug:LogWarning(Object, Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:26)
    AC.KickStarter:OnAwake() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:937)
    AC.MultiSceneChecker:Awake() (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:46)
  • edited July 2016
    I will have to revisit the Motion Controller asset to see if any changes made to it have affected the tutorial.

    Regarding the camera issue:
    1. What camera types are the two "Ogre" cameras?
    2. Are they in the correct positions when the scene is not running
    3. And are they in the wrong position when the error occurs, or is the MainCamera somehow offset from them?  (Pause the game and view them and the MainCamera in the Scene window)

    Let's move to a new topic with this one - please post the answers in a separate thread.

  • Regarding the Motion Controller tutorial, try amending the SetCharacterPosition function with the following:

    private void SetCharacterPosition()
    {
      if (_char.GetPath())
      {
        motionController.SetTargetPosition(_char.GetTargetPosition(), 1f);
      }
      else
      {
        ClearCharacterPosition();

        if (_char.IsTurning () && _char.charState == CharState.Idle)
        {
           Quaternion newRotation = Quaternion.RotateTowards(motionController.transform.rotation, _char.GetTargetRotation(), 5f);
           motionController.SetTargetRotation (newRotation);
        }
      }
    }


    The new lines basically check to see if the character is trying to turn on the spot, and so performs a gradual rotation towards the target.  It's not the cleanest solution, but I can't see from the documentation how else to make a MC-controller character rotate withot assigning a destination.

    I should re-iterate that this is a demonstration on the principles involved in creating an integration on the AC side of things - not an official "Motion Controller integration", and so it's up to the user to tailor the exact script to their own needs.  However, if you find that this does at least fix the turning issue, I shall update the official tutorial with this amendment.
  • edited July 2016
    Chris:

    I'm replying to the code you posted. It works. I can now turn to click Hotspots. I will create a new thread for the Camera issues but I shall also post it here.

    When you use the Motion Controller by ootii, it will automatically add a component to the "_Camera" called "OrbitRig". Remove this component or your cameras will not work as you expect.

  • Thank you, I've replied to the other thread, and will update the tutorial with the code.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.