Game Development Community

Mouse GUI vs Terrain

by Greyfort · in General Discussion · 01/29/2012 (12:13 pm) · 5 replies

I was wondering if there is a way in TS to check ware mouse pointer is?
EXAMPLE:
mouse pointer over canvas=terrain/3dobjects etc. or mouse pointer over a gui say command bar,inventory?

If over inventory and you drag/drop icon onto say either invy gui or canvas it needs to know ware so it can drop either with x,y of gui or x,y,z of the terrain.

anyone know if TS can do this or do I neeed to do this with c++ in tsCNTRL or one of those files

#1
01/31/2012 (9:59 am)
Look at the RTS Prototype article in the Documentation under Scripting > Advanced. This covers terrain point selection and click-to-move behavior.
#2
01/31/2012 (10:56 pm)
I understand that example but that does not work when draging a Icon from a inventory gui to the player gui (x,y,z) unless I missed it. It was a raycast example. Am I missing something Deeper Richard?
#3
02/01/2012 (3:04 am)
Oh, you just want to drag and drop from one gui to another? Perhaps you want to drag an Item from a gui and place it on the terrain? Have you checked out the "GuiDragAndDropControl"? Just look at the editor in T3D's tools and find the functionality you are looking for. I've done some drag and drop from gui's. I bet since onControlDropped will give you the coordinates in 2D form you could pass those into the 3D canvas to raycast a point on the terrain to drop the item. I think that is how I would go about accomplishing that. If you need code examples you need to ask for them. Good luck!
#4
02/01/2012 (11:41 pm)
I want to drag/drop from gui to gui, drag drop to terrain,drag/drop to object i need to be able to tell weather over a gui say inventory, drag that item to the terrain,or a npc,or another gui. I s that a better explanation?

Code examples are great, that's ware i have gotten so far from the documentation. Now my issue is 1) geting the terrain (x,y,z) when drag/drop from inventory gui to terrain. 2) drag/drop to a 3d object say(NPC) or drag/drop 3d object say (table/shelfs/etc.

3)so yes I need 3d(x,y,z) yet the ray cast doesn't seem to work for me if I drop (debug says pos = 0,0)

Thank you for the gui editor info I will look into that.
#5
02/02/2012 (8:52 am)
Did you handle the onMouseUp() in the PlayGui?

I've seen issues dragging from GUI elements into a scene in T2D, so you might have to fiddle with catching that 0,0 and explicitly calling the PlayGui::onMouseUp() from there.... Or some other weird hackery.