but still not showing the asset, when i manually try to add a mesh collider it works, but whenever i try to do that using script it is not working. do you see any issues that might causing this problem ?
The code looks syntetically correct. The only thing missing is adding the newly created entity to the scene, e.g. this.app.root.addChild(newBox);. I would also highly recommend to google javascript coding conventions and pick a common one. Your current style is very hard to read.
Well, not really - no matter how you mangle your code, most of editors can auto-format the code to look normal, so you only making it worse for yourself, picking bad habbits early.
As for the collision issue - the code is correct and it will add a mesh collider. You have to look elsewhere for the problem. I would look into testing that the node you are adding the entity to is correct and that the collision mesh is fine.
You can double check that the script was parsed and the new fields are used (parse button in editor). Apart from that, it is hard to say from the info you have shown. Perhaps you could make a simple project to demo - it would make it easier.
I must search all the enttities in the scene to find that trapColliders and then find the corresponding script and anything related to the problem you have. This project is too big for a quick look. Can you make a new empty project with a single plane and a model to demonstrate the problem?
A quick point: when i try to add manually mesh collider it works,but i want it to be added through script(that means there is no problem with model of collider)
I’ve had a look into your project the other day. There is indeed an issue with the mesh collider not following the animation node for some reason. Attaching some primitive mesh works fine, so I assumed there must be a bug. Your project is pretty large and complex for some simple tests, so I didn’t spend much time though. I was planning to make a blank project to try to reproduce the issue during the weekend. You can help creating one. If the issue can be easily reproduced, we can file a bug report and the team can look at it.
Im going to create simple blank project with the scripts needed to test the mesh colliders following… its really hard to find an issue in such big project though, too many scripts working at the same time and even a single line of code could be causing the issue. but i dont know if it is the problem of any scripts… lets try the test scene then, thanks for taking a look @LeXXik
Finally had a chance to revisit this. Looks like the docs are wrong and the asset field when creating a collision component has to be a number (the asset id), not a pc.Asset type.