Forum rules - please read before posting.

Cursor placement with mouse not aligning

Hi all,

Hope you are doing well!

I was wondering if it is possible to re-center the cursor based on the inventory item selected. Currently, my mouse cursor is pivoted on the top-left of the cursor image.

However, when selecting inventory items, I make the cursor that inventory item. It seems that for some of these items, the top-left pivot doesn't work well (like a flashlight I am selecting).

Is it possible to recenter the cursor based on a custom pivot?

Thanks!

Comments

  • If you supply a separate texture in an Item's "Cursor image (optional)" field, you can specify the offset applied when the cursor takes that image.

  • edited December 2022

    Thank you!
    I'm wondering though -- I don't think I see where I can specify an offset-- is it on the inventory manager tab itself?

  • I noticed that this is possible with hardware cursors, but I don't see the option for Unity UI cursors, so just wondering if there is a workaround for this!

  • Ah. Yes, the offset field is only valid for Software and Hardware cursor rendering.

    With Unity UI, you can either use scripting or Animation to offset the RawImage's RectTransform when an item becomes selected.

    Is the offset the same for all item graphics?

    The Animation approach would be to create and assign an Animator in the Unity UI Cursor component, and then define and specify an Integer Animator parameter in it's "Inventory ID int" field.

    This parameter will be set to the Item's ID value when selected, and -1 otherwise. You could then create an animation that shifts the RectTransform by some amount, and have it react to this parameter through transitions.

    Just be mindful that you shouldn't animate the "RectTransform to position" field, as AC will control this automatically. Moving the RawImage to a child of this and offsetting the child should be fine, though.

  • Oh got it! Thank you so much!
    The offset size is different for each of mine, but I think I can get away with using the hardware cursor mode instead :)

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.