aiaf Posted June 8, 2020 Share Posted June 8, 2020 Hello Have a problem with pick info an entity, i have setup a keyvalue on the model. if (pickinfo.entity->GetKeyValue("mas") != "") { System::Print("hit"); int val = stoi(pickinfo.entity->GetKeyValue("mas")); if (window->MouseHit(1)) { System::Print("hit"); console->mas[val]->DecrementHps(); } } Code above works if i use a boxes (Model::Box) model = Model::Box(0.1, 0.1, 0.1); If i use a model like below: model = Model::Load("Models/Asteroids/AsteroidMobileE_LOD3.mdl"); model->SetScale(0.05); Shape* shape = Shape::Sphere(0, 0, 0, 0, 0, 0, 0.1, 0.1, 0.1); model->SetShape(shape); shape->Release(); The code doesn't detect anymore the mouse over the model. Any idea what is going on here ? im missing something. Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
gamecreator Posted June 8, 2020 Share Posted June 8, 2020 Did you see if it detects just the entity if you don't check for the key? Quote Link to comment Share on other sites More sharing options...
aiaf Posted June 8, 2020 Author Share Posted June 8, 2020 Yes it detects the entity if no key check, i put a print. Here is how i add the keys: for(int i=0; i < masrmax; i++) { mas.push_back(new MissileAsteroid(unitexpmat, GetPointOnSphere(currentUnit->GetModel()->GetPosition(), 10, Math::Random(0, 360), Math::Random(0, 360)), currentUnit->GetModel()->GetPosition(), false)); mas->GetModel()->SetKeyValue("mas" , String(i)); } Inside MissileAsteroid constructor: //model = Model::Box(0.1, 0.1, 0.1); model = Model::Load("Models/Asteroids/AsteroidMobileE_LOD3.mdl"); model->SetScale(0.05); mass = 0.09; model->SetMass(mass); model->SetGravityMode(false); Shape* shape = Shape::Sphere(0, 0, 0, 0, 0, 0, 0.1, 0.1, 0.1); model->SetShape(shape); shape->Release(); Did some debugging below the phases i was interested in Creation of model: model -> entity -> shape In both cases the shape object is initialized ok. Nothing strange here. Pick of entities: pickinfo -> entity keys shape -> aabb I think the aabb is used for physics and maybe to detect picks. shape is null in case of the asteroid model load. keys does not contain the value i added (just a key name with value name of model). Not sure if related to the shape , some exclusion may happen inside for a reason, for sure the keys are not there. Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
Josh Posted June 8, 2020 Share Posted June 8, 2020 I think we will need an example we can run to test this. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
aiaf Posted June 8, 2020 Author Share Posted June 8, 2020 Sure, i attached a test, output on console for mouse click: lep-master.zip Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
Solution aiaf Posted June 11, 2020 Author Solution Share Posted June 11, 2020 I found a workaround, i use TOOLS -> Collapse in the editor and now the pick and keys are ok. Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
aiaf Posted June 12, 2020 Author Share Posted June 12, 2020 i spoke too soon The pick is ok. When i put the collapsed mdls in game , some have a green color all over the model ... other are just black area with some texture seen through When i put back the old mdls without collapse all looks good grey asteroids with textures. Any idea ? really annoying //Leadwerks Material File blendmode=0 castshadows=0 zsort=0 cullbackfaces=1 depthtest=1 pickmode=1 depthmask=1 diffuse=0.20000000,0.20000000,0.20000000,1.00000000 specular=0.501960814,0.501960814,0.501960814,0.501960814 alwaysuseshader=0 roughness=0.50000000000000000 mappingscale=1.00000000,1.00000000,1.00000000 drawmode=-1 shader="Shaders/Model/diffuse+normal.shader" texture0="./asteroidmobilee_diffuse.tex" texture1="./asteroidmobilee_normal.tex" Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station 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.
Note: Your post will require moderator approval before it will be visible.