I can’t figure out how to create the pc.CollisionComponent with code.
This is my falty attempt, it caches when i attempt to set the type to box, witch let me to belive that I had no clue 
var obj = this.app.root.findByName("Box1")
var cc = new pc.CollisionComponent(this.app, obj);
cc.type = 'box';
vaios
2
You don’t create components like that. Instead you use entity.addComponent( componentName, componentData );
In your case you can do:
obj.addComponent('collision', {type: 'box'});
Thank you, that solved it for me, guess that is pretty fundamental knowledge:)
vaios
4
1 Like