Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by irei1as

  1. The easiest way would be to use an external text file that is written by the py and read by the exe in intervals but it may end with access issues if they both try to use it at the same time.
  2. I've done some of that in https://forums.torque3d.org/viewtopic.php?f=10&t=866&sid=26ef5ec3b97cb06d44a72b05f9b1d9e7 but it's just basics and a bit outdated. Feel free to check it and fix it. The part about using it as bitmap comes from named textures and dump function, not sure. On a side note, maybe in 4.1 we'll have camera-based texture render targets.
  3. First you need to give the pair of gui objects global names (there are other ways to do it but global names are the easiest). To set the name write it in its place in the gui editor. http://docs.garagegames.com/torque-3d/official/content/documentation/GUI%20Editor/Overview/Introduction.html You can see the global name box in the picture. It says OptPostFxTo. Let's say you named them 'MyButton' and 'MyBitmap'. Inside the 'DeSign' function that is called when you click the button you add: MyBitmap.setPosition(500,400); MyBitmap.setExtent(100,200); MyButton.setVisible(false); Those functions are from gui in general as you can see in http://docs.garagegames.com/torque-3d/reference/classGuiControl.html Note the format GlobalName.methodName(params); If it doesn't work be sure to check the console for errors. Some name might be misspelled or a ; could be hanged somewhere. Check all the console for red messages. Edit: that documentation is a bit old but it works. For extra help you may want to check http://wiki.torque3d.org/main:documentation or look at some posts around in this forum.
  4. If you're in a single player environment (server=client) you can use the shortcuts LocalClientConnection.player and LocaClientConnection.camera to get the id for the control player and camera. Like: (LocalClientConnection.camera).getEyeVector(); But it's only for single player use. Do not use them if you eventually plan on going multiplayer.
  5. I think I would do: 1st. Tag the objects with a dynamic entry. Something like: BoxObject13.checkData = "Ammo box"; Ah, make sure dynamic entries are set to save. 2nd. Make a function that takes the id of an object and writes in a guiText in the screen that checkData variable. 3rd. Make a ScriptTickObject that makes a raycast each frame to the cross position. If an object is found then use the function. The bad of this approach is that its use of raycasts is kinda liberal... but I don't think it'll be much an issue if it's only once a frame. If it's too bad I guess nobody will notice if it's every 5 frames or something. You could experiment.
  6. If you need C++ you can just copy what array does. Having access to the code is quite convenient. Define a struct with as many elements as you need. Array has strings key and value (you can set whatever values, types and quantity for your need) and then use the class Vector to set the, uh, vector. Err, the header with that is https://github.com/GarageGames/Torque3D/blob/561f010f2e6411d8253d23f0cfcff794e81f60bf/Engine/source/console/arrayObject.h To get the values out use something similar of what you see in its arrayObject.cpp file with getKey and getValue (the Torquescript entry point is the DefineEngineMethod thing).
  7. irei1as

    CMake error

    The name of the project can cause problems, too. Don't use "test" inside the name and avoid using spaces and see if it works.
  8. You can use Point3F DecalRoad::getNodePosition( U32 idx ) instead. It's also located in decalRoad.cpp. Then you only need to show it to TorqueScript with a DefineEngineMethod. If you don't want to change the engine you could also create a Path and add various Marker to it that follows the decal road and just use those instead of the decal road. The downside of doing that is that you have to make two roads (the graphical one of decal road and the script one with markers).
  9. Thanks a lot for the effort. It works well for my Trust compact gamepad gtx24. It detects it as joystick. All the buttons work as normal except, the horizontal of the right stick is detected as both "zaxis" and "rxaxis". But that may be because some faulty drivers I tried to install for an old controller so, what would be the ingame behaviour of a key that throws simultaneously two inputs? As side note, the keyboard is detected as the default English layout instead of my Spanish one, so my ñ key is detected as ; and < between left shift and z isn't recognized (throws a "" as key name). http://ascii-table.com/img/keyboard-071.png But, well, Torque hasn't supported non-English layouts as long as I recall. So I don't think it's very important. If anything I guess the azerty or devorak users have it worse. Ah, F1 doesn't work for me to show the config menu (console throws: pushDialog(): Invalid control: HelpDlg). But I can get it to work using Canvas.pushDialog(JoystickSettingsDlg)
  10. If you're using Visual Studio 2017 (the one recommended for Windows 10) for CMake to work you need desktop c++ (warning: it's like 5 GB) I got a new computer and I only needed that to compile the newest torque 3d. No need of external files of old directx 9 anymore.
  11. I think the problem comes from mixing collision and nodes (armature bone is a kind of node). See, when looking for a node transform you get the root value and not the position it should take from the current animation. I think that can be fixed using in the server mShapeInstance->animateNodeSubtrees(true) but I'm not really sure if that can be used in this resource. I'm still stuck with 3.8 so I can't help right now, sorry. Also, no idea what are the side effects... If anybody knows a detriment of its use I would be grateful to know, thanks. If you want to check if this is your issue, make a model being a single bone going up and down. Then attach the col-mesh to it and try the cast ray a)aiming to the visible position of the animated bone and b)aiming to where the bone is at the root. As an extra, this is the code I've for the node experiments. Feel free to use it if you find it useful (but, not sure if it's usable for the new versions). Inside source/T3D/shapeBase.h add before the end of the definition of class ShapeBase: public: MatrixF getNodeTransformN(const String &nodeName); MatrixF getNodeTransform(const S32 nodeIdx); Inside source/T3D/shapeBase.cpp just at the end: MatrixF ShapeBase::getNodeTransformN(const String &nodeName) { S32 nodeIdx = mShapeInstance->getShape()->findNode(nodeName); return getNodeTransform(nodeIdx); } MatrixF ShapeBase::getNodeTransform(const S32 nodeIdx) { MatrixF returnValue = MatrixF::Identity; if(nodeIdx != -1) { if (isServerObject() && mShapeInstance) mShapeInstance->animateNodeSubtrees(true); returnValue = mShapeInstance->mNodeTransforms[nodeIdx]; } MatrixF objectTransform = getTransform(); Point3F nodeObjPos = returnValue.getPosition(); nodeObjPos.convolve( getScale() ); returnValue.setPosition(nodeObjPos); returnValue.mulL(objectTransform); return returnValue; } DefineEngineMethod( ShapeBase, getNodeTransform, TransformF, (const char* nodeName),, "Get the transform of a named node in the shape.\n" "@param nodeName Name of the node to check.\n" "@return The current transform of the node.\n" ) { return TransformF(object->getNodeTransformN(nodeName)); } --------------------------------------------------------------------------------------------------------------------- In source\T3D\shapeImage.cpp look inside of void ShapeBase::getMountTransform( S32 index, const MatrixF &xfm, MatrixF *outMat ) for MatrixF mountTransform = mShapeInstance->mNodeTransforms[ni]; And add these lines before: if (isServerObject() && mShapeInstance) mShapeInstance->animateNodeSubtrees(true);
  12. There is also the option of object mounting (not just weapon image)to do something kinda like a Mr. Potato but for body parts. But not sure about how good of a performance it'll run if there are a lot of objects. And if things fail to load you may end with a faceless guy like in the old assassin's creed unity.
  13. Torque3d uses a marshalling (?) thing to comunicate between torquescript and C++, I think. What you want is, probably, to use "DefineConsoleFunction". I don't understand much the C++ base to really help you directly, sorry, but what I do is to check the source code for examples. If you know what function you want to check you could do a global search for all the source code for key words with things like notepad++. For reference, the definition of the macro thing is in source\console\engineAPI.h and some examples could be found for example in source\console\consoleFunctions.cpp
  14. Ah, the Player class it isn't only for the active game player. It's just an object that moves like a Player and it can be used as the control object. Maybe something like "actor" could have been more appropriate. When you use "new" you create a new instance that is independent of any other Player object. You are using getPosition() correctly but as you're using it in a new object you just get the initial value of the position as defined in Player::Player(). What you need is to first find the pointer of the player character and then use getPosition() on that. For that you can use getControlObject with the GameConnection GameConnection* connection = GameConnection::getConnectionToServer(); if( !connection ) { //fail with the game. Maybe you haven't started the level. Return an error. } Player* playerObject = dynamic_cast< Player* >( connection->getControlObject() ); if( !playerObject) { //fail. Maybe the control object is a camera or a vehicle not parented to Player } Point3F pos = playerObject->getPosition(); If you add that I think you may need as extra #include "T3D/gameBase/gameConnection.h"
  15. It seems you may have found what's up but let me share something that may be related. If you're changing the camera you also need to use %camera.scopeToClient(%client) or the camera scope fails. I think that's called somewhere from spawnPlayer so it isn't a problem if using that. I had this issue while trying the switching cameras around of one of the old tutorials of the documentation. Was it the adventure thing? The pitch thing may be something related to the Doppler effect. But I'm not sure.
  16. I think I had that issue before. I'll have to test later. If I remember correctly what I did with blender is to change the start frame from "1" to "0". Then the first pair of frames I left as "root" and used the rest for the animations (looping or not). I suspect that extra frame is needed for the number of frames to be correct for posterior loops or something.
  17. I'm having some issues with OpenAL streaming buffers trying to fix the broken SFXSound::setPosition(x), too. Maybe it's related, thanks for the info. By the way, if anybody wants to test streaming sounds make them from sound files longer than 24 seconds. Otherwise they're internally treated like non-streaming samples and the issues don't show.
  18. What I would do: 1st: Disable player movement and victim AI (note: if the conditions for the fatality are met). 2nd: Move the player and the victim to the initial positions and rotations. 3rd: Just use playThread with both of them for the animations they need. 4th: When the animation is finished, do the damage and re-enable the AI and the movement of the player. Issues: -Maybe the player can't be animated correctly. A little C++ change to disable the standard animations for Player class could be needed. -Conditions that interfere in the animation (like being attacked by another enemy). -To move to the correct starting locations could be a bit abrupt. Is there another difficulty I'm not understanding?
  19. I think the easiest way would be to set a global variable with getSimTime() when you do something with a cooldown. $start_of_cooldown = getSimTime(); Then when you use the sight use a conditional to check if the actual getSimTime() is bigger than that variable with the desired increase. %aaa=getSimTime(); if (%aaa < $start_of_cooldown + 2000) return; //2000 ms cooldown, example -Here do the other thigs- The problem with this approach shows when the states have different cooldowns between actions. It can become very complex really fast.
  20. Isn't basic lighting being partly axed since 3.9? That could be part of the problem. Another issue could be an administrator thing. If the program writes files (shaders) into the programs folder new windows admin rights may deny the action. I think there is a variable in the scripts for the shaders to be only virtual or to use another custom folder.
  21. Thanks a lot for the advice. I made a large re-read of all the code and found some wrong stuff I had (& instead of pointers and an incorrect name of a define). It took me some time but I got it working. http://i.imgur.com/UZhAUQb.png Note: cloned cubes with a shared material. The alpha comes from a dynamic variable in the client object. This is the code I got at the end for if anybody wants to give it a try: https://pastebin.com/xLYKEdkY I plan on making the shader a bit more complicated so I can create holes to objects that are between the camera and a 3rd person player (with script raycasts). Another similar use could be to make a x-ray visor. And if I can move the texture I could use them as a base for sprites with a spriteset as texture (just a "quad"* and move the xy for the 2Dtexture). But I'm not sure yet if I can do that with the GenOp.
  22. I thought there was a way to change a trasparency attribute to an object to change the alpha independent of the material but I wasn't able to find it. If that exists it would be what I'm looking for. But without that I'm trying to add an attribute to change the shader and add a color multiplier. The documentation I'm using is these two pages in the torque 3d wiki: http://wiki.torque3d.org/coder:extending-the-torque3d-material-system http://wiki.torque3d.org/coder:assigning-per-shape-shader-values-in-torque3d But I'm failing. The program just explodes when I add the TSStatic with the variable using a function. This is what I've done for now: https://pastebin.com/x6PRgd7j The material is: singleton Material(cube_Reddes) { mapTo = "Reddes"; diffuseColor[0] = "0.64 0.0492256 0.0569901 1"; specular[0] = "0.5 0.5 0.5 1"; specularPower[0] = "50"; translucentBlendOp = "LerpAlpha"; translucent = true ; multConstant = true; }; And the TSStatic is: new TSStatic(TheCube) { shapeName = "./cube.dae"; playAmbient = "1"; meshCulling = "0"; originSort = "0"; collisionType = "Collision Mesh"; decalType = "Collision Mesh"; allowPlayerStep = "0"; alphaFadeEnable = "0"; alphaFadeStart = "100"; alphaFadeEnd = "150"; alphaFadeInverse = "0"; renderNormals = "0"; forceDetail = "-1"; position = "0 0 0"; Rotation = "1 0 0 0"; scale = "1 1 1"; canSave = "1"; canSaveDynamicFields = "1"; visibility = 0.5; multConstant = "0.1 0.1 0.1 0.1"; }; Thanks for your help.
  23. You need to use singleton CustomMaterial instead of Material. The shader thing is for CustomMaterial only. I have my ShaderData as singleton. That may be also something you may want to change and I think it's better for that ShaderData to be defined before the CustomMaterial that uses it. Now that I think about it, I don't recall default templates using any example CustomMaterial. Maybe one should be added as reference in one of the new modules.
  24. I use a postFX as a tool to update a texture manipulated inside a shader. You can see what I tried in this resource: http://forums.torque3d.org/viewtopic.php?f=23&t=714 You see that in the PostFX MapTest I chooose the target to be a named texture "#maptexture". Also check the functions related to MapTest like the function MapTest::setShaderConsts(%this). But named textures are "special" "named" textures in the engine. I'm not sure if it'll help you in your particular case. Maybe the c++ code I mention at the start can help you to change a named texture into a generic texture if you need that.
  • Create New...