Jump to content

irei1as

Members
  • Posts

    84
  • Joined

  • Last visited

irei1as's Achievements

  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"
×
×
  • Create New...