playMaker

Author Topic: Dragging Angled UI Element &Constraining to Canvas [solved]  (Read 1454 times)

Aus

  • Playmaker Newbie
  • *
  • Posts: 3
    • Sadware Computer Club
Dragging Angled UI Element &Constraining to Canvas [solved]
« on: January 15, 2016, 07:24:32 PM »
Howdy folks; two questions! One's quick one and another slightly more involved. Thanks in advance for any advice! I'm a 3D artist and PlayMaker has been good to me.

1- Sometime while I was importing FSM templates from an older project, I messed up a bunch of my PlayMaker's default actions- I've tried deleting all my playmaker assets and re-importing, but with no luck. Many actions are now missing dialogs and checkboxes. How can I reinstall/reset all the actions without starting a new project?

2- The source of all this: I've been tampering with this all day. It's the popular mouse_position Drag and Drop dilemma (with a sprite, on the uGUI canvas) but with a twist. When I try to drag the sprite along the screen, it is moved somewhere totally inaccurately, off canvas.
I've fixed issues like this before, by locking in the sprites position on the z-axis.
But I suspect its mad because my canvas is angled, either that or set_position is being funky; My maincamera is top-down, so my canvas is rendered onto the angled camera/screen space.

I've experimented with the mouse_position's world & screen space, un/normalized positions, delta variables, separate  x&y variables- but everything misses. I had the most success with the drag rigid body custom action, but I dont want it to be physics-driven. Just the cursor position.

The ultimate goal is to drag 2D items from a small inventory into the 3D world, which I hadn't had this much trouble with before now. My icon keeps popping away when clicked!
« Last Edit: January 16, 2016, 06:53:01 PM by Aus »

Aus

  • Playmaker Newbie
  • *
  • Posts: 3
    • Sadware Computer Club
Re: Dragging Angled UI Elements & Constraining to Canvas
« Reply #1 on: January 16, 2016, 06:52:35 PM »
Aha! I solved the big issue thanks to an old forum post I'd dug up. I wasn't having any luck with "Screen to World Point" or "drag on 3d plane", but  I was able to start using  screen pick from the mouse to an invisible plane (parallel to my canvas) in order to get my own world UI coordinates.

I also solved my first question earlier yesterday- sorry for the double post. I merely started a new project and reimported all my old scenes and gunk as a unity package. Playmaker restored without deleting prototype.


the old topic & post (visit thread for image from quote)
http://hutonggames.com/playmakerforum/index.php?topic=2253.0
as long as you have the object specified (can get that from a screen pick) the attached screenshot will work, I use it to move a created object from the previous fsm