subabrain Posted July 11, 2017 Author Share Posted July 11, 2017 hi there,sorry i want to apologize!but i just tried everything and thats really hard to know that im new to torque engine and nobody can help.please dont understand this wrong ...so thanks anyway!greetingsRobert Quote Link to comment Share on other sites More sharing options...
subabrain Posted July 11, 2017 Author Share Posted July 11, 2017 okay here a explanation for what i need this function ;)i want to mow a meadow with a ride-on mower i have all but i dont know exactly what can i do in this case. i have a few ideas - do something with the footstep or with triggers or - what i think is the best way - the terrain-painter (call from script).So thanks a lot for the answer - but im new to torque maybe you could explain a bit more - so i can understand ...okay now you know why i need this :)greetingsRobert Quote Link to comment Share on other sites More sharing options...
Duion Posted July 11, 2017 Share Posted July 11, 2017 How about attaching the terrain painter to the player model with size 1? Just an idea. Quote Link to comment Share on other sites More sharing options...
subabrain Posted July 11, 2017 Author Share Posted July 11, 2017 Hi,yes that sounds good - but how can i attach it?thx a lot ;)greetzRobert Quote Link to comment Share on other sites More sharing options...
Duion Posted July 11, 2017 Share Posted July 11, 2017 No idea, learn to search for it.I would make it as a weapon and while wearing the weapon or using it, put the function that paints the terrain there instead of damaging something.Get Torsion if you do not have already and make a breakpoint to see what functions the engine calls when you do something. Quote Link to comment Share on other sites More sharing options...
subabrain Posted July 12, 2017 Author Share Posted July 12, 2017 Hello again :Pas i wrote: hey guys,i find out something good...thats how you an set the brush (for painting etc.): ETerrainEditor.setBrushPos(getWord(%curPos, 0) + %x, getWord(%curPos, 1) + %y); and get the brush: %curPos = ETerrainEditor.getBrushPos(); now i just need to "paint" on the brush position... - maybe you can help me?Thank you very much!GreetzRobert Sorry that im disturbing you :/but i know how to set the position of the brush... i tried to paint through the command Azaezel shows ... but maybe someone could tell me how i get this right?i tried to make the player position to the brush one - thats working ...i hope you could help me a last time ... would be nice - THANKS!GreetingsRobert Quote Link to comment Share on other sites More sharing options...
Duion Posted July 12, 2017 Share Posted July 12, 2017 So now you need to know what happens when you press the mouse button on the terrain painter?I don't know where this is done, maybe try setting a breakpoint and see what happens, I think it is in terrainEditor.ed.cs Quote Link to comment Share on other sites More sharing options...
subabrain Posted July 12, 2017 Author Share Posted July 12, 2017 So now you need to know what happens when you press the mouse button on the terrain painter?I don't know where this is done, maybe try setting a breakpoint and see what happens, I think it is in terrainEditor.ed.cs yes thats the point - theres nothing shown in the console or somewhere else in torsion when i do the paint in the terrainpainter :/okay but i hope we will get it ;)thanks alot - i try to search the "terrainEditor.ed.cs" again :)greetingsRobert Quote Link to comment Share on other sites More sharing options...
Duion Posted July 12, 2017 Share Posted July 12, 2017 Then it will probably be in the C++ source code.I looked it up for you and it may be this one:https://github.com/GarageGames/Torque3D/blob/development/Engine/source/gui/worldEditor/terrainActions.cpp#L197-L247 Quote Link to comment Share on other sites More sharing options...
subabrain Posted July 12, 2017 Author Share Posted July 12, 2017 hey - thanks alot for this answer :)i will try to modify 8)edit: yes it seem to work - thx!greetzRobert Quote Link to comment Share on other sites More sharing options...
subabrain Posted July 13, 2017 Author Share Posted July 13, 2017 hi there,okay i made an output from the method and when i press the mouse button while painting.So its the right thing :)but i have troubles to be able to execute this function by torquescript ... i read some things but i dont know if im right ..would be nice i you could help me (maybe i will find it out faster) :P :)Thanks a lot for your help!Regards -Robert Quote Link to comment Share on other sites More sharing options...
subabrain Posted July 14, 2017 Author Share Posted July 14, 2017 hey there,i stuck a little bit :Pi want to call the method "PaintMaterialAction::process" from torquescript.so now i took the following in the c++ code:DefineEngineFunction(tesla, void, (), , ""){ PaintMaterialAction::process;}and the following to the torquescript:DefineEngineFunction( tesla, void, (),, "" ) { echo("test");} so this is not working.what do i made wrong?Thanks a lot and gn8 ;)Robert Quote Link to comment Share on other sites More sharing options...
Duion Posted July 15, 2017 Share Posted July 15, 2017 I'm not very good at the C++ side, but I would look if you find something that already does the same thing that you want and copy it and replace it with your function.Otherwise I cannot help you much with that. Quote Link to comment Share on other sites More sharing options...
subabrain Posted July 16, 2017 Author Share Posted July 16, 2017 hi,okay now i found out how to call a c++ method from torquescript.Now i only have to execute the PaintMaterialAction::process method - but im sure to find it out ;)greetzRobert Quote Link to comment Share on other sites More sharing options...
subabrain Posted July 23, 2017 Author Share Posted July 23, 2017 hi,sorry i didnt get it :(greetzRobert Quote Link to comment Share on other sites More sharing options...
Bloodknight Posted July 23, 2017 Share Posted July 23, 2017 look for TerrainEditor::autoMaterialLayer in terrainEditor.cpp, this shows how to paint the terrain via code. Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 10, 2017 Author Share Posted September 10, 2017 Hello Guys,sorry for the long delay but i dont get it :/i tried all things - to manipulate the c++ methods and try to search for solutions but i dont get it!i now get it to execute c++ functions with torque 3d but they dont get it to run -> for example:---------------------------------------------------------------------------------------------------------------------------grass.cpp #include "grass.h" #include "console/simBase.h" #include "console/console.h" #include "gui/worldEditor/terrainEditor.h" #include "gui/worldEditor/terrainActions.h" IMPLEMENT_CONOBJECT(grass); void grass::set_grass() { TerrainEditor *edit = new TerrainEditor(); edit->autoMaterialLayer(-10000, 10000, 0, 90, 100); } ---------------------------------------------------------------------------------------------------------------------------grass.h #ifndef _SIMBASE_H_ #include "console/simBase.h" #include "gui/worldEditor/terrainEditor.h" #endif class grass : public SimObject private: typedef SimObject Parent; public: grass() { grass::set_grass(); } virtual ~grass() {} virtual void set_grass(); DECLARE_CONOBJECT(grass); };---------------------------------------------------------------------------------------------------------------------------And the TorqueScript:grass.cs function grasses() { %obj = new grass(); %obj.set_grass(); } ---------------------------------------------------------------------------------------------------------------------------okay - but i just need to now how i can paint the material on a certain position :roll: please help me - thx a lot!Greetings - Robert! Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 13, 2017 Author Share Posted September 13, 2017 Then it will probably be in the C++ source code.I looked it up for you and it may be this one:https://github.com/GarageGames/Torque3D/blob/development/Engine/source/gui/worldEditor/terrainActions.cpp#L197-L247 i think this is the key - but how to execute this method?i tried to make an instance and all the method ... but whats with the arguments?please help me -.-GreetzRobert Quote Link to comment Share on other sites More sharing options...
Duion Posted September 14, 2017 Share Posted September 14, 2017 The arguments are named, you pass them along when you use the function.If you miss arguments you usually get an error message like "invalid number of arguments got 2 expected 3" etc.If you use debug mode in Visual Studio you can even see the data that is passed along with the function. Quote Link to comment Share on other sites More sharing options...
JeffR Posted September 14, 2017 Share Posted September 14, 2017 If that's the whole code for your object, you still need a consoleMethod definition so the script system knows what the function isSimilar to [ur=]https://github.com/GarageGames/Torque3D/blob/development/Engine/source/T3D/shapeBase.cpp#L4936-L4947lthis,[/url] you would do something like: DefineEngineMethod( grass, set_grass, void, (),, "@Paints some grass.\n\n" ) { object->set_grass(); } What this does, is informs the script engine that objects of the 'grass' class have a function called set_grass() that can be called. When it's called, the above is executed by the script engine. So it'll take object(which is automatically the class of the first argument in the DefineEngineMethod function - in this case, "grass" - and then we call set_grass for it.2 minor nitpicks from your examples I spotted(just to encourage good habits ;) ) you wouldn't want to have the grass::set_grass() call in the constructor. The method isn't static for one thing. Secondly, set_grass doesn't need to be virtual unless you plan to have classes inherit from grass and also have their own set_grass() function. You can leave that as a regular old function, since we'll be calling it through the DefineEngineMethod stuff :) Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 14, 2017 Author Share Posted September 14, 2017 Hello,first - thanks alot for your help - i did the steps you told.Its working like you said. but how can i get these arguments in the method:void PaintMaterialAction::process(Selection * sel, const Gui3DMouseEvent &, bool selChanged, Type)?Okay - gn8 ;)Greetz Robert Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 15, 2017 Author Share Posted September 15, 2017 Hello Friends,okay now i found something usefulhttp://abighole.hngamers.com/terrainDeformer.zipi hope i get it with this one ;)greetzRobert :D Quote Link to comment Share on other sites More sharing options...
Azaezel Posted September 15, 2017 Share Posted September 15, 2017 You won't. The terrain has undergone 3 revisions since then. Though the general principles do still apply. Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 16, 2017 Author Share Posted September 16, 2017 Hi,omg - what shall i do now?sorry for penetrating you but i am at the end of my knowledge :? please help!greetingsRobert Quote Link to comment Share on other sites More sharing options...
subabrain Posted September 17, 2017 Author Share Posted September 17, 2017 Hello,i have a plan now - i let you know if its ready ;)greetzRobert 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.