Select Object Arrows
Blitz3D Forums/Blitz3D Programming/Select Object Arrows
| ||
I'm trying to select and move the object for my level editor with the mouse anyway I could do that? <Image Removed> |
| ||
A CameraPick for the colored parts on first detected MouseDown, then move the entity with MouseXSpeed/MouseYSpeed depending on picked direction. My code for moving with the mouse usually follows this pattern: Global down If MouseDown(1) Then If Not down Then ; enter move state down = True MouseXSpeed() MouseYSpeed() EndIf ; inside move state ; move it here using MouseXSpeed() and MouseYSpeed()) ElseIf down Then ; leaving move state down = False EndIf |
| ||
I have two objects, Now when I select one object to move, the other one goes missingIf MouseDown(1) Then CameraPick(Maincam, MouseX(), MouseY()) For obj.tobj = Each tobj If PickedEntity() Then PositionEntity obj\mesh,PickedX#(),0,PickedZ#() Next EndIf |
| ||
I assumed from your picture you wanted a movable thingy, like what 3D editors have, but looking at your code you are doing placement instead? In any case, heres some code to move a thingy with the mouse: |
| ||
but what about object rotation? |
| ||
Replace MoveEntity with TurnEntity? |
| ||
I know this off topic but I need to fix this error. Trying to make level list ListDir=ReadDir("c:\test") Repeat lvfile$=NextFile$(ListDir) If lvfile$="" Then Exit If FileType("c:\test"+"\"+lvfile$) = 2 Then DebugLog("c:\test"+"\"+lvfile$) list.levlist = New levlist y=y+1 list\y=y EndIf Forever CloseDir ListDir Type levlist field name$,y End Type I only have one folder in test but it says three how can I fix this? |
| ||
You need to check for "." and ".." too and skip them. |
| ||
I did but it still doesn't work.ListDir=ReadDir("c:\test") Repeat lvfile$=NextFile$(ListDir) If lvfile$="" or lvfile$="." or lvfile$=".." Then Exit If FileType("c:\test"+"\"+lvfile$) = 2 Then DebugLog("c:\test"+"\"+lvfile$) list.levlist = New levlist y=y+1 list\y=y EndIf Forever CloseDir ListDir Type levlist field name$,y End Type |
| ||
"." and ".." are the two first elements of a directory, your loop never reaches any further because you exit to early. |
| ||
Still didn't workListDir=ReadDir("c:\test") Repeat lvfile$=NextFile$(ListDir) If lvfile$="" Then Exit If FileType("c:\test"+"\"+lvfile$) = 2 Then list.levlist = New levlist y=y+1 list\y=y DebugLog("c:\test"+"\"+lvfile$) EndIf If lvfile$="." or lvfile$=".." Then Exit Forever CloseDir ListDir Type levlist field name$,y End Type |
| ||
That's because you're still exiting as soon as you find them. You should only exit if lvfile$ is empty (untested): ListDir=ReadDir("c:\test") Repeat lvfile$=NextFile$(ListDir) If lvfile$="" Then Exit If FileType("c:\test\"+lvfile$) = 2 Then If lvfile$<>"." And lvfile$<>".." Then list.levlist = New levlist y=y+1 list\y=y DebugLog("c:\test\"+lvfile$) EndIf EndIf Forever CloseDir ListDir Type levlist field name$,y End Type |
| ||
Only will do one object but not other objects |
| ||
1. Did the code I posted for you in #12 work? 2. If you're posting as much code as you have in #13 it's probably better to use [codebox][/codebox] than [code][/code]. 3. Did you write the code in #13 yourself - or are you trying to adapt someone else's? I assume you want to know why only one object is getting processed in the For/Next loop? Could you please highlight where in your code are you creating multiple objects? Repeatedly posting chunks of code with a vague question/statement is not likely to get much response - particularly if you do not acknowledge people's efforts to help. |
| ||
Yep the level list works now. grable's code My code |
| ||
umm... so why is it doing it wrong moving only one object? |
| ||
I get a memory access violation |
| ||
your debugger is off. |
| ||
I tried your latest code, but it doesnt even compile, and even after making it compile its not setup correctly. Anyway... You are confusing the various objects you are selecting and moving, i assume you dont want to move ALL objects like you are attempting to do (with all those For loops), lots of redundant code. Heres what i got after some fixing, i added creation of new objects with space. Also i added some indentation, as i could not read it without. Notice that the first mousedown has 2 states now, using entity type 0 for the real objects and still 1,2,3 for the axl. |