I am trying to set the position and width of a trigger collision object that is a child of my game object file. I tried:
go.set("#trigger", “width”, 64)
but that didn’t work. Is there a way to print out what properties are available? Or is there another solution to change the position and width of a collision object at runtime?
Unfortunately you can’t change the size of a collision object at runtime (it is a feature that has been requested before). You can spawn new ones with different uniform scales, but you can’t change them after spawning.
You can see all the available properties of each component type in the API Reference, such as here for collision objects components. Note that some of these may be read-only (which will be specified in their descriptions).
so how do you spawn a separate trigger area? do I rely on all traps having the same physics definition?
It was demoed around the same time last month built in debugger was previewed so it is most likely coming just a matter of when.
@Pkeod Yeah! I saw that too, pretty awesome. I wonder if non-uniform scaling will be included (every game needs laser beams!).
You can spawn new collision objects (attached to game objects) with a factory whenever you want, and can give them a uniform scale, but other than that you can’t change them at runtime. If you want objects with different proportions, collision groups, etc, you will have to use different objects, made beforehand in the editor.
Yes, possibly, but there are often different ways to do it. Can you describe in more detail what you want to do?
Yes. So I have this arrow trap that has a trigger area that spawns an arrow when the players enters the trigger area. The arrow trap either faces right or left. Therefore the trigger area needs to be on either the left or the right of arrow trap. I came of with a “fix” where I have separate game objects for the left facing arrow trap and the right facing arrow trap, but it’s kinda hacky tbh
OK. Could you just rotate the trap?