#Update: Rotation issue is fixed, but

1 messages · Page 1 of 1 (latest)

cosmic echo
#

I'm lost on what the issue and setup is now

gleaming heart
cosmic echo
#

What does the targetImage inspector look like now?

gleaming heart
#

Laying Bottle is target

cosmic echo
gleaming heart
gleaming heart
cosmic echo
#

test something..

Go into play mode -> grab the bottle and pause it -> change the width of that rect to 70

#

or just change that rect to 70 before grabbingn the bottle

#

probably just need to click 'preserve aspect' on the image components

gleaming heart
#

Ok, so I notice changing x value changes for both A & B within the drag

#

Preserve aspect worked!

cosmic echo
#

because they're different sized sprites, your image rect is set to fit the laying down bottle... when you switch the standing bottle, it's stretching to fit the rect. Preserving the aspect stops it stretching to fit, and keeps it at the correct aspect ratio to fit within the bounds of the rect

gleaming heart
#

The standing bottle is a little smaller though

cosmic echo
# gleaming heart

also, FYI - you don't need GameObject imageBObject. Every component can access the gameobject. so, you can just do targetImage.gameObject.SetActive() .. that way you don't need to assign two things in the inspector leading to a possible mistake

cosmic echo
gleaming heart
#

Is it possible to increase the standing while keeping the laying?

#

Also I plan for the books laying in the locker to stand up upon grabbing (same as blue one)

cosmic echo
#

You'd be better off having..

  • Parent object with an invisble image sized to what you want (set the colour alpha to 0)
  • two children objects, one for each bottle
  • toggle the correct bottle on/ off for when grabbed etc
#

the two child would just have an image component on them

gleaming heart
#

Does that mean the code would need to be altered?

cosmic echo
#

A little bit.
You won't need any of the sprite swapping, and you'll need references to the two new game objects to toggle

gleaming heart
#

Or is this ok?

#

I'll give you a break for now though and step away from comp for a bit. Thanks for sticking with it this far by the way.