☑ addComponent collision issue

Hello, i have found this suggestion for add a collision component to a entity

entity.addComponent("collision", {
    type: 'mesh'
});
entity.collision.model=modelAsset;

i thought it was more correct

var modelAsset = app.assets.find("bow.json", "model");
entity.addComponent("collision", {
    type: 'mesh',
    asset: modelAsset
});

any suggestion?

modelAsset - is an asset, if you do entity.collision.model = .. you attach asset, not model. Which is wrong.
What is actually a question?

I see, so the right script must be entity.collision.model=entity.model; since the entity model is already defined, i noticed that in rigidbody i defined it as ‘Dynamic’ and didn’t work so i changed it to ‘dynamic’ and now fall through the ground, means collision don’t work, i tried to add enabled: true inside the addComponent but nothing changed … little lost

entity.model - is a ModelComponent, not a Model.
If it falls through ground - means your ground has no proper collision.

No the ground is ok, the problem is to write in the right way the entity.collision.model line. Since the modelAsset is an asset, the entity.model is a ModelComponent and use directly ‘bow.json’ doesn’t work too… i think i miss a notion

Are you using the Editor? I think this should work:

this.entity.addComponent('collision', {
    type: 'mesh',
    asset: yourModelAsset
});

You also need to add a rigidbody to the same Entity in order for collision to work… So also:

this.entity.addComponent('rigidbody', {
    type: 'static'
});

i already set that as dynamic

tryed this and still goes through ground :frowning: sigh

Hi again, i have done a test, and i have got the problem:
if i create an entity with model + rigidbody + collision component it will fall through the ground, to solve that i need an entity with a rigidbody & collision components, and a child with the model, that way it works…awww… was tiring

Edit: but to attach it to the character i need to disable rigidbody and collision…headache

Got this problem with your code:
image