Forum rules - please read before posting.

Click to Move...moving, but not to where I clicked on screen

I did a blank scene....added a floor with some blocks....created navmesh...put it on navmesh layer (forgot to do that originally).....

Got the click to move to work....but it doesn't move to where I clicked on screen.
Say I clicked on bottom of screen, I see an animation of the location it thinks I clicked, and it is way back on the floor, and the character does move to that spot....

I guess it's something to do with the ray casting????

Comments

  • I click on bottom (blue arrow), but it moves to where red arrow is pointing.
    I have navmesh in navmesh layer
    I also have floor plane with mesh collider, also in navmesh layer.

  • Ok I figured it out...
    My MainCamera and my GameCamera were using two different field of view values...
    When I made them the same, the issue got fixed and works now

  • OK....still have issue.....
    On GameCamera, in GameCamera script section, Spin Rotation
    If I enable the Spin Rotation + Look at Target...
    I get issue again, where I click in one place and move to another place, not to where I clicked on the screen

  • Your MainCamera should always have the same FOV, position and rotation as the GameCamera it's "attached" or "switched" to.

    Make sure that your GameCamera is assigned in the Scene Manager's Default camera field, and that you're keeping your GameCamera and MainCamera scripts on separate objects.

    Also note that only your MainCamera should have the "MainCamera" tag, and only this GameObject's Camera should be performing any actual rendering.

    At runtime, the bottom of the MainCamera's Inspector should display the name of the GameCamera it's attached to. Check that this is showing correctly.

    If you've done this and things aren't correct, please share screenshots and details showing how your cameras are set up.

  • edited March 2020

    I am having the same issue!

    Enabling Spin Rotation + Look at Target seems just to work until the cameras rotation reaches 180 degree. Then the players movement seems to get inverted in all directions.

  • edited March 2020

    I deleted GameCamera and re-created it...(NavCam)
    Still have issue (with Spin disabled it works, but with Spin enabled it does not work)

    MAINCAMERA SETTINGS (MainCamera)

    GAMECAMERA SETTINGS (NavCam)

  • I am using HDRP project....I do not think this is the issue....

  • Here is what I did in a quick nutshell
    ....I used SpeedTutor scene from Asset Store (free)
    https://assetstore.unity.com/packages/3d/environments/speedtutor-tutorial-scene-free-159460

    I created navmesh, put it in navmesh layer
    Added mesh collider to floor...put it in navmesh layer, as well
    Imported FBX model, made it into prefab....set as default player
    Made game camera (NavCam), turned on Spin Rotation.....

  • edited March 2020

    ALSO
    I did copy the scripts folder with the camera scripts, into Assets folder

  • edited March 2020

    I am using HDRP project....I do not think this is the issue....

    The RP shouldn't be related, but temporarily remove the Post Process Layer component - does that have any effect?

    I did copy the scripts folder with the camera scripts, into Assets folder

    Which scripts? AC scripts or some other camera scripts?

    Your MainCamera has a "Simple Camera Controller" script on it - this should be moved to a new SimpleCamera prefab (or Camera with a Basic Camera component on it), so that the MainCamera itself is not controlled directly. See the Manual's "Custom cameras" chapter for more on this topic.

    Still have issue (with Spin disabled it works, but with Spin enabled it does not work)

    Is that GameCamera screenshot taken when the issue occurs?

    Do both the GameCamera, and the MainCamera, point in the same, correct direction? And the issue is only that clicking results in the raycasting being incorrect?

    @miccel123 I'd appreciate your feedback here, too. I am not able to recreate such an issue - please share screenshots and/or details on how to recreate the problem.

  • I will do a new project to see if still happens, perhaps I did something wrong.

  • edited March 2020

    Good news....
    It seems to be working correctly now. (When I re-created project)
    The only difference was that I did NOT import the SpeedTutor scene, I just used a plane.
    When I tried to import SpeedTutor this time, it said it would change project settings, so I cancelled the import. I just used a plane instead.

    But I have a question, I had to copy the Animation + Animators + Scripts folder from my original test project (which had the ClickToMove controller......and camera scripts)

    This does not seem to be included with regular AC setup??? (It wasn't there when I imported AC)

    I think they got made from the Unity 3D sample game used in tutorial?

    In other words, to use "ClickToMove", you have to dl and import Unity's sample 3D game(???)

  • edited March 2020

    ClickToMove is not part of AC. But of course, AC has it's own point and click system - no custom script is necessary for this.

    What you're after is AC's "Point And Click" movement method, which is set in the Settings Manager. See the Manual's "Point-and-click movement" for more on this.

    Remove any of these custom scripts from your scene, make sure your NavMesh is baked, that the floor is on the NavMesh layer, and that your Scene Manager's Pathfinding method field is set to Unity Navigation.

    For a proper introduction, however, please see this tutorial as covers AC's point-and-click system in depth.

    I would advise against incorporating other scripts into your game until you're familiar with how AC works on its own. If you're new to AC, then definitely the tutorial videos are the recommended first step. This tutorial, though in 2D, still covers the basics that are used by all games and is the one I recommend for newcomers to AC.

  • edited March 2020

    I have tried to reproduce this behavior. I even created a new project but no luck. It works as intended now.
    It happened right after upgrading to the newest version of AC. Since my project starts to grow fast the orgin of this bug may lies somewhere else. Maybe it's the horizon based ambient occlusion script I bought two weeks ago which is also attached to the MainCamera. I don't wanna blame AC here.

    I'll keep an eye on this and report you right away if it occurs again.

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.