Inventory GUI to Canvas(world frame)
by Ironbelly Studios · in General Discussion · 12/14/2008 (11:18 pm) · 2 replies
Hi All,
Yeah, I have done the search.. But the thing is I don't know where to implement those
codes, means in which .cs or .cc or .h or .gui.
I got my Inventory right as I wanted. But I couldn't drag-drop those items from
Inventory GUI to the canvas GUI by using Mouse. On inventory, mouse is working fine, like droppedupon
from one slot to an another.
So say you drag it out to the top of the
screen and let go, it would fly hard and high, if you dragged it to
the bottom it would be thrown at their feet.
So please suggest me how to drag an Item from Inventory GUI and drop it to the Canvas GUI..
Do I have to go for some other interfaces between 2 GUI(INVENTORY and CANVAS)??
Lot of Thanks in advance.......
Yeah, I have done the search.. But the thing is I don't know where to implement those
codes, means in which .cs or .cc or .h or .gui.
I got my Inventory right as I wanted. But I couldn't drag-drop those items from
Inventory GUI to the canvas GUI by using Mouse. On inventory, mouse is working fine, like droppedupon
from one slot to an another.
So say you drag it out to the top of the
screen and let go, it would fly hard and high, if you dragged it to
the bottom it would be thrown at their feet.
So please suggest me how to drag an Item from Inventory GUI and drop it to the Canvas GUI..
Do I have to go for some other interfaces between 2 GUI(INVENTORY and CANVAS)??
Lot of Thanks in advance.......
About the author
Associate Michael Hall
Distracted...
What you would need to do would be to determine if you are trying to release an object from inventory into the world. Maybe, on the mouse release action, if it finds that you are not trying to place anything in another gui inventory slot that it instead finds the screen space coordinates of the mouse. You can then spawn the object and drop at the player's feet if your mouse was at the bottom of the screen. If at the top you would "throw" it with variable impulse depending on the distance from the center of the screen. Same thing for the left and right sections of the screen. And only do that if the mouse release isn't over another inventory slot.
I would start by examining the existing item throw and toss scripts just so you know how to create and impulse dropped objects - that's the easy part. The tricky bit will be converting the mouse position into vectors to be used.