Jump to content

doc

Members
  • Posts

    17
  • Joined

  • Last visited

Posts posted by doc

  1. I had a very bad surprise: Torque was crashing at startup!

    It keeps crashing since the Nvidia card driver 361.75.


    If you have this problem too, don't worry and say thanks to @Lopuska for the fix!


    The problem was in GFXD3D9CardProfiler::init(). For some reason, the driver combined with my hardware didn't

    really loved the way Torque was asking to enumerate the devices, leading to a crash on startup.


    here's the fix:


    gfxD3D9CardProfiler.cpp


    include this:

     

    #include 
     
    #pragma comment(lib, "dxgi.lib")

     


    then replace the function "void GFXD3D9CardProfiler::init()" with this one:

     

    void GFXD3D9CardProfiler::init()
    {
       mD3DDevice = static_cast(GFX)->getDevice();
     
       IDXGIAdapter1 *adapter;
       IDXGIFactory1* factory;
       HRESULT hres;
       hres = CreateDXGIFactory1(__uuidof(IDXGIFactory1), reinterpret_cast(&factory));
       factory->EnumAdapters1(static_cast(GFX)->getAdaterIndex(), &adapter);
       DXGI_ADAPTER_DESC1 desc;
       adapter->GetDesc1(&desc);
     
       mCardDescription = desc.Description;
       mVideoMemory = desc.DedicatedVideoMemory / 1048576; //convert to megabytes
     
       adapter->Release();
       factory->Release();
       Parent::init();
    }

     

    compile, and here's torque working again!

  2. I've always found quite annoying to name each single object while working in Blender.

    Expecially when it comes to make a model for Torque.

    If you are using trailing numbers for the LOD, you will quickly notice how splitting a mesh adds a .001,002 and such.


    Say we want to make a huge TSStatic and we want it to be culled in parts, the result will be similar:


    http://i.imgur.com/8d8OuLE.png


    There's a cool utility called Name Panel, and can be found here: https://github.com/trentinfrederick/name-panel

    You just have to select your objects, the hit space, batch name and select "selected", the little brownish cube and done.

    No. Doesn't work with our LOD, it would number our shape as shapeLOD500.1 etc.


    How to solve this problem?


    download the zip from github and unpack it.

    go to scripts/function/batch.py

    around line 2576 https://github.com/trentinfrederick/name-panel/blob/master/scripts/function/batch.py#L2576


    change:

    [code2=python]# duplicates

    if collection[item[1]][0] not in duplicates:

     

    # name

    if hasattr(collection[item[1]][1][1], 'name'):

    collection[item[1]][1][1].name = collection[item[1]][0] + option.separator + '0'*option.padding + str(i + option.start).zfill(len(str(collection[item[1]][1][0])))

    elif hasattr(collection[item[1]][1][1], 'info'):[/code2]

     

    to:

     

    [code2=python]# duplicates

    if collection[item[1]][0] not in duplicates:

    # name

    if hasattr(collection[item[1]][1][1], 'name'):

    optSt = option.start-1

    if(optSt < 0):

    optSt = 0

    trail = chr((i + optSt) + ord("A"));

    collection[item[1]][1][1].name = collection[item[1]][0] + option.separator + '0'*option.padding + trail + option.suffix

    elif hasattr(collection[item[1]][1][1], 'info'):[/code2]

     

    and around line 2595 https://github.com/trentinfrederick/name-panel/blob/master/scripts/function/batch.py#L2595


    change:

    [code2=python]# name

    if hasattr(item[1][1], 'name'):

    item[1][1].name = item[0]

    elif hasattr(item[1][1], 'info'):[/code2]

     

    to:

     

    [code2=python]# name

    if hasattr(item[1][1], 'name'):

    item[1][1].name = item[0] + option.suffix

    elif hasattr(item[1][1], 'info'):[/code2]

     

    at last, around line 2646 https://github.com/trentinfrederick/name-panel/blob/master/scripts/function/batch.py#L2646


    change:

     

    [code2=python]# prefix & suffix

    newName = option.prefix + newName + option.suffix[/code2]

     

    to:

     

    [code2=python]# prefix & suffix

    newName = option.prefix + newName[/code2]

     

    then install the script normally.

    When you will run the batch name, it will append the suffix at the end of the object's name and adds a letter instead of a number. For instance:


    CubeLOD300.1

    CubeLOD300.2

    CubeLOD300.3


    will be:


    Cube.ALOD300

    Cube.BLOD300

    Cube.CLOD300


    just remove the "separator" from the field in the menu to an empty and the suffix to -LOD300 and you will have:


    CubeA-LOD300

    CubeB-LOD300 and so on.


    the result with the previous example is now this:


    http://i.imgur.com/S4b51Ez.png


    I hope it will be useful!

  3. I also had the same problem, I suggest to use your own shader for that:

    you can specify which shader to use for the drops and splashes as you can see here https://github.com/GarageGames/Torque3D/blob/2044b2691e1a29fa65d1bdd163f0d834995433ce/Engine/source/T3D/fx/precipitation.cpp#L1633


    To do that, add this to a .cs file (for instance, core/scripts/client/shaders.cs)

    new ShaderData( fxPrecipitationShader )
    {
       DXVertexShaderFile 	= "shaders/common/precipV.hlsl";
       DXPixelShaderFile 	= "shaders/common/precipP.hlsl";
     
       OGLVertexShaderFile  = "shaders/common/gl/precipV.glsl";
       OGLPixelShaderFile   = "shaders/common/gl/precipP.glsl";
     
       samplerNames[0] = "$diffuseMap";
       samplerNames[1] = "$alphaMap";
     
       pixVersion = 1.4;
    };

     

    then in your precipitation datablock add these two fields:

     

    dropShader = fxPrecipitationShader;
    splashShader = fxPrecipitationShader;

     

    if you are still unhappy with the result, you can tweak the shader or make a new one, just replace the DXVertexShaderFile and the other ones with your tweaked/new shader.



    NOTE:


    Keep in mind that your texture is not in tiles as it is supposed to be by default...

    Check here: https://github.com/GarageGames/Torque3D/blob/2044b2691e1a29fa65d1bdd163f0d834995433ce/Engine/source/T3D/fx/precipitation.cpp#L159

  4. I was wondering about what @rlranft suggested..picking up the raycast contact point normal could also add the correct rotation to the object. Tomorrow I'll try to make some experiments but I'm not sure if I have the math to get the object rotation from the contact point normal..

  5. @rlranft I already knew about the editor snapping function, but I wasn't sure if it would snap also in non-editor mode and/or on other shapes that are not a terrain. The point of the functions is to help me spawn (in my case)aircrafts over stuff like rigidShapes etc. by script and at random places.


    For the cave I'd suggest to try by giving to castray a negative value and also change here:

    groundPos.z += getWord(%obj.getWorldBox(),2) - %pos.z; //inverted the order to snap to top


    to make it snap from top(otherwise it would snap inside the shape).

    I'm not sure tho if it wold work..

  6. I was looking for a way to automate a bit my workflow and I wrote these two functions that some might find useful.

    So I decided to share them:


    This function returns the "ground point" of the given position:

    function getGroundPoint(%pos,%terrainOnly) 
    {
    	%mask = ($TypeMasks::GameBaseObjectType | $TypeMasks::PlayerObjectType | $TypeMasks::TerrainObjectType |
    		$TypeMasks::StaticTSObjectType | $TypeMasks::StaticObjectType 
           | $TypeMasks::WaterObjectType |  $TypeMasks::DynamicObjectType
           |  $TypeMasks::RigidObjectType );
     
    	if(%terrainOnly)
    	{
    		%mask = $TypeMasks::TerrainObjectType ;
    	}
     
    	%endPos = %pos;
    	%endPos.z = -10000;
    	%result = 0;
    	%result = containerRayCast(%pos, %endPos, %mask);
    	if(!%result)
    	{
    		%endPos.z = 10000;
    		%result = containerRayCast(%pos, %endPos, %mask);
    	}
    	if(%result)
    	   %retval = %pos.x SPC %pos.y SPC getWord(%result,3);
        else
    	{
    		warn("getGroundPoint(): RayCast can't find any object in range! Returning original position.");
    		%retval = %pos;
    	}
    	return %retval;
    }

     


    And this one snaps a given object to the ground respecting its scale and preserving rotation:

     

    function putOnGround(%obj)
    {
    	%transform = %obj.getTransform();
    	%pos = getWords(%transform, 0, 2);
    	%rot = getWords(%transform, 3, 6);
    	%groundPos = getGroundPoint(%pos);
    	%groundPos.z += %pos.z - getWord(%obj.getWorldBox(),2);
    	%newTransform = %groundPos SPC %rot;
    	%obj.setTransform(%newTransform);
    }

     


    here's some images to show the result:


    The code is called from the console and is as simple as

    putOnGround(myObject);

    or

    putOnGround(%obj);

     

    before:

    http://i.imgur.com/LCH1D3c.png


    after:

    http://i.imgur.com/BUmuwvN.png


    and here with scale and rotated along an axis:


    before:

    http://i.imgur.com/6VcS4gN.png


    after:

    http://i.imgur.com/gVZbD7E.png

  7. I worked quite a bit with Torque's FlyingVehicle class ( as you can see here )


    I had to tweak a lot the C++ code to avoid having the aircraft flying as kinda balloon and also,

    be aware of the fact that it doesn't support an independent roll.


    You'd have to implement it by adding a new axis in:

    vehicle.cpp and flyingvehicle:.updateForces in flyingvehicle.cpp for rotation on the forward axis.

  8. I'm making a game about aircrafts dogfight! ;)

    I feel both love and hate for Torque3D for various reasons but IMHO the easy C++ api and the workflow makes it good for single man developers:

    Unless you are very good in everything, none will notice if your game has been made in whatever engine.

×
×
  • Create New...