subabrain Posted September 18, 2017 Author Share Posted September 18, 2017 hi there,here a little video of my try on changing groundcover with torque 3d:https://www.youtube.com/watch?v=obYls7lnc-8its not finished - just an idea from me.what i need is to set the player to the position of the brush :)thanks a lot!greetingsRobertPS: im not klicking anything - it shows the material automatically by code - im just moving around with the view ;) Quote Link to comment Share on other sites More sharing options...
JeffR Posted September 21, 2017 Share Posted September 21, 2017 Very nice, dude! Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 22, 2017 Author Share Posted September 22, 2017 Hi Guys,after working endless i found the key function... how to change material on a specific Position - but im not ready now with it ... void TerrainEditor::on3DMouseDown(const Gui3DMouseEvent & event) { getRoot()->showCursor( false ); if(mTerrainBlocks.size() == 0) return; if (!dStrcmp(getCurrentAction(),"paintMaterial")) { Point3F pos; TerrainBlock* hitTerrain = collide(event, pos); if(!hitTerrain) return; // Set the active terrain bool changed = mActiveTerrain != hitTerrain; mActiveTerrain = hitTerrain; if (changed) { Con::executef(this, "onActiveTerrainChange", Con::getIntArg(hitTerrain->getId())); mMouseBrush->setTerrain(mActiveTerrain); //if(mRenderBrush) //mCursorVisible = false; mMousePos = pos; mMouseBrush->setPosition(mMousePos); return; } } else if ((event.modifier & SI_ALT) && !dStrcmp(getCurrentAction(),"setHeight")) { // Set value to terrain height at mouse position GridInfo info; getGridInfo(mMouseBrush->getGridPoint(), info); mSetHeightVal = info.mHeight; mBrushChanged = true; return; } mMousePlane.set( mMousePos, Point3F(0,0,1) ); mMouseDown = true; mSelectionLocked = false; mouseLock(); mMouseDownSeq++; mUndoSel = new Selection; mCurrentAction->process(mMouseBrush, event, true, TerrainAction::Begin); // process on ticks - every 30th of a second. Sim::postEvent(this, new TerrainProcessActionEvent(mMouseDownSeq), Sim::getCurrentTime() + 30); } now i just have to get it running :)if you can help me please answer 8)GreetingsRobert Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 23, 2017 Author Share Posted September 23, 2017 Hi again,okay it seems to do the job - but i have a littl Problem."SuperType": Ist kein Element von "Gui3DMouseEvent"what does this mean?Thank you very much!Greetings Robert Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 23, 2017 Author Share Posted September 23, 2017 Hey,here a cool thing - this is the solution: void TerrainEditor::processAction(const char* sAction) { if(!checkTerrainBlock(this, "processAction")) return; TerrainAction * action = mCurrentAction; if (dStrcmp(sAction, "") != 0) { action = lookupAction(sAction); if(!action) { Con::errorf(ConsoleLogEntry::General, "TerrainEditor::cProcessAction: invalid action name '%s'.", sAction); return; } } if(!getCurrentSel()->size() && !mProcessUsesBrush) return; mUndoSel = new Selection; Gui3DMouseEvent event; if(mProcessUsesBrush) action->process(mMouseBrush, event, true, TerrainAction::Process); else action->process(getCurrentSel(), event, true, TerrainAction::Process); // check if should delete the undo if(mUndoSel->size()) submitUndo( mUndoSel ); else delete mUndoSel; mUndoSel = 0; } this code makes all you need!and call it from torque script like this: ETerrainEditor.processAction("paintMaterial"); but it needs some specific things i didnt know at the moment but it has to do like this!So stay tuned and good luck!!!GreetingsRobert Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 24, 2017 Author Share Posted September 24, 2017 Hello there,okay - its almost perfect - just have to move the brush position - but its working: //Set the Brush size here - not necessary ETerrainEditor.setBrushSize(30, 30); //Read the index from a specific material - in this case the material with name "sand" %matIndex = ETerrainEditor.getMaterialIndex( "sand" ); //Here set the paint material and paint it - "test" is in this case the name of your terrain ETerrainEditor.setPaintMaterial(%matIndex, "test" ); ETerrainEditor.processAction("paintMaterial"); i hope i could help you 8-) the only thing to do is the brush position .... but thats all you need - you dont have to make anything with c++ ;)so thanks a lot!Greetings Robert Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 24, 2017 Author Share Posted September 24, 2017 hi,sorry but i have a little problem with this solution...its only working with the active TerrainEditor ... :/please help me ...thanks and stay tuned!Robert Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 25, 2017 Author Share Posted September 25, 2017 Hello Friends,this is the last Post of getting the stuff to work - this is my solution to view:https://youtu.be/mFWtS1sQfnEIf you need help - just ask ;)GreetzRobert Quote Link to comment Share on other sites More sharing options...
JeffR Posted September 25, 2017 Share Posted September 25, 2017 Sorry, I hadn't seen your message yesterday, though I'm glad you got it working!If you can, I'd say go ahead and make a thread in the Resources area with your changes in case someone else wants a similar effect :) Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 25, 2017 Author Share Posted September 25, 2017 Hi, yes i would do a little tutorial but first i have to modify it a little bit ;)greetzRobert Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 28, 2017 Author Share Posted September 28, 2017 Hi there,here an working example of my solution:https://www.youtube.com/watch?v=-SSio2tMuDAtutorial will follow ;)greetzrobertPS: Can someone Tell me how i make editor commands in play mode? thx! Quote Link to comment Share on other sites More sharing options...
JeffR Posted September 29, 2017 Share Posted September 29, 2017 Haha, yes! Lawnmower Simulator 2017 here we come ;) Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 29, 2017 Author Share Posted September 29, 2017 yes this should do it ;)but it only works in the terraineditor :/maybe someone could help me ... would be very nice 8)greetingsRobert Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 30, 2017 Author Share Posted September 30, 2017 Hi Guys,to make the thing simple - i need to make fullscreen mode in terraineditor.it would be great if you can answer :)greetingsRobert Quote Link to comment Share on other sites More sharing options...
Duion Posted September 30, 2017 Share Posted September 30, 2017 In the latest version you can launch the editor in fullscreen, no idea when it was added, but in my game it works. Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 30, 2017 Author Share Posted September 30, 2017 hi,thanks for your answer but i need the editor without any window ...please tell me how you do it ;)thanks!greetzRobert Quote Link to comment Share on other sites More sharing options...
subabrain Posted October 1, 2017 Author Share Posted October 1, 2017 Hi there,i just want to say that i will take a while till my tut is ready because i have Problems to reproduce it with several versions of t3d ...but im working on the problem ;)greetings and nice sunday!Robert Quote Link to comment Share on other sites More sharing options...
subabrain Posted October 2, 2017 Author Share Posted October 2, 2017 Hi Guys,sorry for the amount of posts here but i have a problem with my solution - now i try it directly with the grid functions of t3d ;)please be patient - it takes a little bit ^^have a nice day!Robert Quote Link to comment Share on other sites More sharing options...
subabrain Posted October 2, 2017 Author Share Posted October 2, 2017 Okay now,i get it 8-)So for change the groundcover (here the terrain Material which can layered by Groundcover) from torquescript do the following (without c++):go to the file "EditorGui.ed.gui" in the folder "tools/worldEditor/gui" and change the line: processUsesBrush = "0"; into processUsesBrush = "1"; then go to "scripts/server/" and create a File - name it "grass.cs" with the following content: function grass(%this) { //Make the size of the brush ETerrainEditor.setBrushSize(2, 2); //Set the Shape of the brush ETerrainEditor.setBrushType("box"); //Change "grass1" to the material you like %matIndex = ETerrainEditor.getMaterialIndex( "grass1" ); //Change "test" to a terrain id you like ETerrainEditor.setPaintMaterial(%matIndex, "test"); //%curPos = LocalClientConnection.Player.getPosition(); //%x = getword(%curPos, 0); //%y = getword(%curPos, 1); //%pZ = getword(%trans, 2); //ETerrainEditor.processAction(%pX, %pY, %pZ, "paintMaterial"); //ETerrainEditor.setBrushPos(getWord(%curPos, 0) + %x, getWord(%curPos, 1) + %y); //Run the thing ETerrainEditor.processAction("paintMaterial"); //$eventID = schedule(230,0,grass); } please recognize that the Comments are important for make the brush pos to the player ...Then add a entry in "scriptExec.cs" with the folder "scripts/server/" somewhere in the file: ... exec("./grass.cs"); ... Okay now you can add a material texture with run the command "grass();" in the console (can be opened with "^" in game).There is a thing to get the Ground of the Player to be changed ->From C++ it works with some arguments...But it should do it also with the TorqueScript -> therefore is a function: %curPos = LocalClientConnection.Player.getPosition(); %x = getword(%curPos, 0); %y = getword(%curPos, 1); //%pZ = getword(%trans, 2); ETerrainEditor.setBrushPos(getWord(%curPos, 0) + %x, getWord(%curPos, 1) + %y); But its not working in my case :/I get the following error: scripts/server/grass.cs (19): ETerrainEditor::setBrushPos - wrong number of arguments (got 4, expected min 3 and max 3). maybe someone could help me here :roll: but thats the way how to do it without C++ ;)GreetingsRobertPS: As soon as it works perfect ill make a bigger tutorial - but i think im not getting it without c++ :roll: Quote Link to comment Share on other sites More sharing options...
subabrain Posted October 3, 2017 Author Share Posted October 3, 2017 Good Morning Guys,EDIT: i will do it with the processAction method (like shown before) ;)there will follow a tutorial soon 8-)greetings and nice day!Robert Quote Link to comment Share on other sites More sharing options...
subabrain Posted October 4, 2017 Author Share Posted October 4, 2017 Hello my Friends,its done!!!here my tutorial about it:http://blog.beran-solutions.de/2017/10/04/mow-a-meadow-with-torque-3d/i hope its working for you!!!Have a good Time!!!RegardsRobert Quote Link to comment Share on other sites More sharing options...
subabrain Posted October 6, 2017 Author Share Posted October 6, 2017 Sorry Guys,i had a wrong html entities at my blog - sorry for that!please try with the new one :)and remove the old one ...thanks a lot!PS: if somebody get an error now - just post it and i will help you! Quote Link to comment Share on other sites More sharing options...
JeffR Posted October 6, 2017 Share Posted October 6, 2017 Sweet! I'll have to check this out this weekend. Nice work, good sir! Quote Link to comment Share on other sites More sharing options...
subabrain Posted November 3, 2017 Author Share Posted November 3, 2017 Hi there,sorry there are bugs in my tutorial :/i will fix them shortly!!!Sorry for that!greetzRobert Quote Link to comment Share on other sites More sharing options...
subabrain Posted November 25, 2017 Author Share Posted November 25, 2017 Hi there,look here for more information:http://forums.torque3d.org/viewtopic.php?f=12&t=1124&start=20Thanks!GreetingsRobert Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.