Jump to content

Recommended Posts

Posted (edited)

For the life of me cannot get my new static object to have any kind of collision in-game at all. The process I (think) is what I should be doing is as follows:

 

1: Export my main static model (this works fine in-game).

2: Create my lower poly collision mesh

3: Assign the low poly collision mesh user defined property

 

TYPE = "collision_shell";

 

Does not seem to matter if I assign it a material or not as its not rendered

 

4: Create a MyModel.lods file

 

model = {
   lods = {        
       {"MyModel.EDM",1000000.000000};
   };
   collision_shell = "MyModel_CollisionShell.EDM";
}

5: Create my MyModel.lua file mounting the model file path:

 

-- Simple Bomb Target


mount_vfs_model_path    (current_mod_path.."/Shapes/")
mount_vfs_model_path    (current_mod_path.."/Shapes/MyModel.EDM")
mount_vfs_model_path    (current_mod_path.."/Shapes/MyModel_CollisionShell.EDM")
mount_vfs_model_path    (current_mod_path.."/Shapes/MyModel.lods")
mount_vfs_texture_path  (current_mod_path.."/Textures/")


GT = {};
set_recursive_metatable(GT, GT_t.generic_stationary)
set_recursive_metatable(GT.chassis, GT_t.CH_t.STATIC);
GT.chassis.life = 1

GT.visual.shape = "MyModel.EDM"
GT.visual.shape_dstr = ""

--Burning after hit
GT.visual.fire_size = 0 --relative burning size
GT.visual.fire_pos = {0,0,0};
GT.visual.fire_time = 0 --burning time (seconds)
GT.time_agony = 180;


--Name Stuff
GT.Name = "MyModel"
GT.DisplayName = _("MyModel")
GT.Rate = 1



GT.DetectionRange  = 0;
GT.ThreatRange = 0;
GT.mapclasskey = "P0091000076";
GT.attribute = {wsType_Ground,wsType_Tank,wsType_NoWeapon,wsTypeVAZ,
               };
GT.category = "Civilians";
               
add_surface_unit(GT)

My main model EDM and Lods file and Collision shell mesh EDM are all in the shapes folder. (not sure if it's even necessary for me to mount each file when I have already mounted the /shapes/ folder but doing so or not doesn't seem to make it work.)

 

However this does not seem to work. No collision is shown and if I view my collision model inside the ED model viewer I can see nothing aside from the model axis (which are correct) or if I choose to show bounding box, then it does show the correct bounding box size for the collision model. Using the console command "showcol" doesn't seem to work either in the ED model viewer on my collision model. Also obviously no collision in-game either.

 

The question is is having my lods file and my main model EDM named the same all that is necessary for the collision mesh to function (seeing as it's called in the lods file) or do I need to call it somewhere else.

 

Have tried all sorts of things but cannot seem to get my model to use the collision mesh EDM in-game at all. Can anybody see where I am going wrong with this?

 

Any pointers would be hugely appreciated.

Edited by Tetra
Posted

It appears you don't have a (dstr) destroyed model defined in the LUA. Create one and see if that works.

 

GT.visual.shape = "MyModel.EDM"
GT.visual.shape_dstr = ""

https://magnitude-3.com/

https://www.facebook.com/magnitude3llc

https://www.youtube.com/@magnitude_3

i9 13900K, 128GB RAM, RTX 4090, Win10Pro, 2 x 2TB SSD, 1 x 15TB SSD U.2

i9 10980XE, 128GB RAM, RTX 3090Ti, Win10 Pro, 2 x 256GB SSD, 4 x 512GB SSD RAID 0, 6 x 4TB HDD RAID 6, 9361-8i RAID Controller

i7 4960X, 64GB RAM, GTX Titan X Black, Win10 Pro, 512GB PCIe SSD, 2 x 256GB SSD

Posted

Hi Rudel, many thanks for the help, sadly that did not seem to fix the issue. I'm not quite sure what's going wrong with this, doesn't seem to matter what size, shape or type of collision mesh I make it is just ignored in-game, although in the ED model viewer I can see the collision mesh with showcol (only actually shows it in the standalone model viewer as opposed to the DCS world one for some reason). I can also load my lods file in the model viewer and see the collision mesh there with showcol. I'm really lost as to what is causing this. Many thanks for your help again.

Posted (edited)

Just to add to this, strangely I noticed that my LOD settings work fine in both the standalone model viewer and the DCS world one, I set my primary LOD to 50, zoom out in the standalone viewer and the model disappears as expected, so it's obviously reading my Lods file. However in the DCS world model viewer my collision mesh does not show with "showcol" but yet it does in the standalone model viewer. Wondering if there is some naming convention discrepancy between the two applications. Also in-game my lod settings are not being read at all, model is still there out to full visible range.

 

EDIT: Ok well I guess the reasoning is my lua file simply isn't using my lods file for some reason. Anybody got any idea how to call the lods file from the LUA script?

 

EDIT2: Ok getting somewhere script should be calling

 

GT.visual.shape = "MyModel";

NOT

 

GT.visual.shape = "MyModel.edm";

LOD settings from the lods file is now being read in-game, collision still not sure on yet, will continue testing.

 

EDIT3: Collision still not working ..

Edited by Tetra
Posted (edited)

Ok disregard, seems to be a problem with my model, larger sized models seem to freak out the physics somewhat, while they retain weapon collisions the AI don't seem capable of navigating around them for some reason. Also models which are large in width but short in height (for example 100x100x1) instantly seem to loose collision. Will post my finalized lua and lods files later along with any further findings for anybody who finds this thread with a similar issue.

 

 

EDIT:

 

Final LUA and lods file for anybody that has a similar issue who needs them. From further investigation it seems the height of the object needs to be at least %10 of the width to prevent the collision shell physics from breaking (so a 100mx100m object would need to be at least 10m tall for example.)

MyModel.LUA

 

mount_vfs_model_path    (current_mod_path.."/Shapes/");
mount_vfs_texture_path  (current_mod_path.."/Textures/");


GT = {};
GT_t.ws = 0;
set_recursive_metatable(GT, GT_t.generic_stationary)
set_recursive_metatable(GT.chassis, GT_t.CH_t.STATIC);
GT.chassis.life = 5000

GT.visual.shape = "MyModel";
GT.visual.shape_dstr = "MyModel";

--Burning after hit
GT.visual.fire_size = 0; --relative burning size
GT.visual.fire_pos = {0,0,0};
GT.visual.fire_time = 0; --burning time (seconds)
GT.time_agony = 1;


--Name Stuff
GT.Name = "MyModel";
GT.DisplayName = _("MyModel");
GT.Rate = 1;



GT.DetectionRange  = 0;
GT.ThreatRange = 0;
GT.mapclasskey = "P0091000076";
GT.attribute = {wsType_Ground,wsType_Tank,wsType_Gun,wsType_GenericFort,
               "Fortifications",
               };
GT.category = "Fortification";

add_surface_unit(GT)

MyModel.lods

 

model = {
   lods = {
       {"MyModel.EDM",1000000.000000};
   };
   collision_shell = "MyModel-collision.edm";
}

Edited by Tetra
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...