I’am having trouble when I try to remove a renderer component of an entity, to make it invisible. However Codea just crashes instead of giving me an error.
Here is my project:
https://www.dropbox.com/s/tefbg1mk3wbkcuv/Tiny Rockets.zip?dl=0
It’s quite long but the part where everything fails is at the Quadtree class. Maybe you can help?
Comments
@GR00G0 I tried running your code, but I’m not sure what is supposed to be happening. If I comment out the local cam= line in setup, I can run the code and I see an object that I can rotate. It doesn’t crash, but I’m sure it’s not doing everything you want it to do.
@GR00G0 I wonder if when you execute
self.entity:remove(craft.renderer)
it crashes because it doesn’t know what to remove. Like I said I’m not sure about everything you’re doing so that’s just a guess.@GR00G0 Here is your code that I’m executing when it crashes. If I comment the line
self.entity:remove(craft.renderer)
it doesn’t crash. So what are you trying to remove with that line.Edit: And I can’t just set the model or material to nil.
@GR00G0 I’m not following your code very well. I can see that you’re trying to remove self.entity, but what is self.entity pointing to. If I print out self.entity, it just says entity, so I don’t know what self.entity is referring to.
@GR00G0 So far I figured out that self.entity is the mesh your creating in the class Quad. Is that true.
Edit: My problem is it works as long as remove it in the Quadtree:init() function but it doesnt work in the update function, and I have checked Its not because it’s trying to remove it twice. The code nlock there only get’s executed once.
@GR00G0 I’m not into Craft that much because I’m waiting for the final version along with better documentation. I don’t understant all of the adds along with the adds in the classes and so on. It’s hard to keep track of what’s where and what’s actually happening. Maybe if I wrote the code and I knew exactly what I was trying to do would help me understand it, but to look at someone else’s code isn’t helping. So I guess I’ll just leave it for someone who understands Craft more than I do help you.
@GR00G0 I posted code awhile ago showing that if you get inside an entity, it disappears. There’s still a lot I need to learn about Craft and I just need to play around with all of the adds and removes and other thing to get a grasp of how Craft actually works.
Edit: Neither does rigidbody
entity.active=false will make it invisible
@GR00G0 i guess it would
@GR00G0 while waiting for the bug fix, perhaps setting its size to zero, using entity.scale=vec3(0,0,0) might be a work around.