camerapick & returning the name of a child mesh
Blitz3D Forums/Blitz3D Beginners Area/camerapick & returning the name of a child mesh
| ||
Hey there everyone, still working away on my world editor & am trying to now move objects around with a widget. What i want is to pick an object, & the widget appears with the X, Y & Z axis, then i pick the axis i want with a mouse click & drag the object along the axis. The problem i am having is how to return the name of the children in the widget mesh. When i do pick the child it returns a number like 23456127 & is different every time i run the program. Here is the code i have used to setup the child names & pick modes of all the children. Global widget = LoadAnimMesh("media\widget.b3d") For i=1 To CountChildren(widget) child=GetChild(widget,i) EntityPickMode child,2 EntityOrder child,-1 Next ScaleEntity widget,2,2,2 Global Widget_X = FindChild(widget,Xaxis) Global Widget_Y = FindChild(widget,Yaxis) Global Widget_Z = FindChild(widget,Zaxis) Also how would i go about dragging the widget with the mouse along the direction one of the widget's axis is facing, as in not just moving the mouse along a 2d x axis to move the widget along its x axis. For example with this image of my editor, is there a way to drag the widget along it's X axis on the angle by dragging it in the direction it is facing |
| ||
Sorry should have included the camerapick code i am playing with to check for what axis has been picked.If MouseHit(1) Axis_picked = CameraPick(camera,MouseX(),MouseY()) End If Select Axis_picked Case Widget_X If MouseDown(1) Then MoveEntity widget, msx*.1,0,0 End If Case Widget_Y If MouseDown(1) Then MoveEntity widget,0,-msy*.02,0 End If End Select It's a very basic piece of code i was using just to try & return the name of the axis being picked. Any help will be greatly appreciated. Cheers. :) |
| ||
Ok, got the returning child names sorted, though differently to the way i was trying but it works.If MouseHit(1) Axis_picked = CameraPick(camera,MouseX(),MouseY()) If Axis_picked <> 0 Then Name = EntityName$(PickedEntity()) Else Name = 0 End If End If Select Name Case "Xaxis" If MouseDown(1) Then MoveEntity widget, msx*.1,0,0 End If Case "Yaxis" If MouseDown(1) Then MoveEntity widget,0,-msy*.1,0 End If Case "Zaxis" If MouseDown(1) Then MoveEntity widget,0,0,-msy*.1 End If End Select Now just to figure out how to move the widget along the direction the axis is facing, just found the cameraproject() so i am tipping that will be used. :) |