Forum rules - please read before posting.

Draggable moves when player moves after being clicked ones

edited June 2021 in Technical Q&A

Hi, i followed your FPS tutorial making the Cupboard door but it does not behave as i want it.

After i have clicked on it and run around with my player the door moves when the player moves.

i have no clue why, it´s a true mystery.

MalteMP

Video
https://imgur.com/vJQLTI5

pictures
https://imgur.com/wnoo8L0
https://imgur.com/boR4G9I
https://imgur.com/cppusen

Comments

  • See your Console - you are getting error messages related to the lack of an AC MainCamera.

    In the Settings Manager, uncheck Cache 'Camera.main' variable? and then tag your FPS controller's Camera as "MainCamera".

  • edited June 2021

    Hi, i dont think that´s the problem, cacheCameraMain is already unchecked and the fpscontrollers camera already had that tag.

    main camera/settings/ error messages
    https://imgur.com/VD7WZG8

    cube cupboard door
    https://imgur.com/MJ48CKW

    draggable
    https://imgur.com/OBLuol4

    this is the error messages if i click the draggable object when playing.

    NullReferenceException: Object reference not set to an instance of an object
    AC.DragBase.IsOnScreen () (at Assets/AdventureCreator/Scripts/Moveable/DragBase.cs:313)
    AC.HeldObjectData.AttemptRelease (System.Boolean force) (at Assets/AdventureCreator/Scripts/Moveable/HeldObjectData.cs:55)
    AC.PlayerInput.UpdateDrag () (at Assets/AdventureCreator/Scripts/Controls/PlayerInput.cs:1991)
    AC.PlayerInput.UpdateInput () (at Assets/AdventureCreator/Scripts/Controls/PlayerInput.cs:737)
    AC.StateHandler.Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:144)

    Thank you for answering:)

  • The error message are coming from the lack of an AC MainCamera in your scene.

    Add the MainCamera prefab back in your scene from /Assets/AdventureCreator/Prefabs/Automatic/MainCamera.

    Your own "PlayerCamera" will then need to be changed to a custom camera type. To do this, untag the GameObject and add AC's Basic Camera component. Then, assign it as the scene's "Default Camera" in the Scene Manager.

    More on custom camera types can be found in the Manual's "Custom cameras" chapter.

  • Now i have no errors and it´s working a little better.
    but it does not look as if it´s rotating from the min to the maximum on the hinge...

    and it only moves if i click, hold, and walk forward/backward. Then it moves but wierdly.

    video
    https://imgur.com/YS0s9bf

    hinge track
    https://imgur.com/jw9mLgC

    draggable
    https://imgur.com/MbalpH4

    (oven door)
    https://imgur.com/8foziqr


    first person aio
    https://imgur.com/r4vFdy4

    player camera
    https://imgur.com/8wJXsmR

    nav cam1
    https://imgur.com/PNUsjtq

    _Making PickUp´s are super easy but draggables i find hard. :sweat_smile: _

  • Draggables are more complex than PickUps, true - but they're also heavily integrated with Player and Camera motion.

    Your camera is not set up in the way I described above - don't attach your MainCamera to the First Person camera, but add it separately, then switch to your First Person camera by attaching a Basic Camera component.

    It would be best, however, to temporarily replace your First Person AIO Player with a built-in AC First Person character - as we will first need to make sure things are working without the addition of custom / non-AC camera and controllers scripts.

    You can get a first-person Player prefab from the Downloads page - add it to your scene and disable your existing Player for the moment. How do things behave then?

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.