Jump to content

Pick info entity issue question


aiaf
 Share

Go to solution Solved by aiaf,

Recommended Posts

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.

 

 

 

 

I made this with Leadwerks/UAK:

Structura Stacky Desktop Edition

Website:

Binary Station

Link to comment
Share on other sites

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.

 

I made this with Leadwerks/UAK:

Structura Stacky Desktop Edition

Website:

Binary Station

Link to comment
Share on other sites

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"

 

I made this with Leadwerks/UAK:

Structura Stacky Desktop Edition

Website:

Binary Station

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...