Forum rules - please read before posting.

Implementation of a Drawable Sprite / NotePad

Hi
I am currently trying to integrate the Free Draw asset from the Unity Asset Store into my 3D Direct Adventure game. My objective is to provide players with a virtual notepad where they can take visual notes during gameplay.

However, I have encountered challenges in utilizing the Drawable Component of this asset within the UI. Despite multiple attempts, I have been unsuccessful in implementing it successfully. Additionally, I have observed that the asset functions exclusively with an Orthographic Camera and inside the scene.

For a specific scene, I resorted to placing the asset outside the scene and used crossfading cameras or split-screen approach. Nevertheless, I am seeking guidance on how to transform this functionality into a notepad accessible across all scenes.

My main consideration was to implement a menu UI triggered by a key press. However, the MenuUI option appears to be impractical for achieving this goal.
I tried to use Image as Graphic Element, Raw image all. Not succesful. Given the complexity of Unity for me, I am reaching out to inquire whether Adventure Creator (AC) might offer a solution. I have noticed that AC often contains hidden functionalities beyond my current awareness.

I appreciate your expertise or insights on this direction.
And thank you for your time and assistance.
Best regards,

Comments

  • edited December 2023

    To get it working with Perspective cameras, replace the Drawable script's:

    Vector2 mouse_world_position = Camera.main.ScreenToWorldPoint (Input.mousePosition);
    

    with:

    Vector2 mouse_world_position = Camera.main.ScreenToWorldPoint (new Vector3 (Input.mousePosition.x, Input.mousePosition.y, 10f));
    

    Replacing "10" with the distance along the Z axis between the camera and the Image.

    As the asset relies on collision and sprites, you wouldn't be able to have it be in a Menu directly - but you could show/spawn it in at the same time you show a Menu, with e.g. the Object: Add or remove Action inside a Menu's ActionList when turn on asset.

    If your Camera is rotating in 3D space, however, you'll probably need to rely on a separate "UI" Camera that only renders your Menus (using a separate layer and camera stacking). This camera can be then facing frontwards (and optionally orthographic), in a fixed position/rotation so that it can always be correctly facing the drawing sprite no matter where the "main" camera is.

    You'd need to modify the script's use of Camera.main to use the UI camera, but look into getting a UI camera for your regular UI up and running first.

  • Wow! You are amazing Chris!
    Thanks i am just going to do it now.

  • edited December 2023

    .

  • I looked out and find out what is Camera stacking.
    with AC i feel like i have participated in a great Unity course! I learned alot since i used AC. Thanks.

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.