The game object created with a factory lose it's collision object

I tried to attach a collision object (capsule shapes) to my game object, so that I can perform a raycast to detect a selection operation on it.
Everything works well if I added this game object to my collection, but the collision object is not there if I created the game object with a factory.
image

The first game object is added to the collection statically, the second one is created by a factory dynamically. Both of them shared a same .go file. The test project just has one single collection.

You should report here too

Sue, I will file an issue there

1 Like

What if you try with a box or sphere shape?

Seems only capsule shapes is supported in 3D mode

I tried 2d game object created by factory, the attached box shape collision object can be created correctly and works well
image

Yes, capsules can only be used when physics is set to 3D. There should be a warning/error in the console about this when you build and run.

I am using 3D mode in my game, so I have to choose capsule shapes as the collision object…

When Physics is set to 3D in game.project: Box, Sphere and Capsule
When Physics is set to 2D in game.project: Box and Sphere

This is core functionality and I’d be very surprised if it’s broken.

Oh, I realized I misunderstood the document:

Box and sphere shapes can works in 3d mode!

Unfortunately, box shapes collision object has same problem in 3D mode.
image

I’m unable to reproduce this. I create 10 game objects each containing a model and a kinematic collision object with a box shape:

Could you upload this example for @joshua.winters to test?

Sure, here we go: https://github.com/britzl/publicexamples/tree/master/examples/threedee

Thanks @britzl for the example, with more investigation on my game object, I found the collision object is really created with the game object, but it was not set proper scale with the game object.

My game object scale was set to vmath.vector3(100), so the collision object is too small to be found.

I tried to set scale to vmath.vector3(0.2) to the create game object to your example, seems the collision object is not changed too.

2 Likes

update: if I set the scale parameter in factory.create() function, it works for the collision object also, but if I use go.set_scale() to resize the created game objects, the scale is not work on the collision objects.

1 Like

Yeah, you can’t scale collision objects at runtime still (they have been working on it afaik). If you need to scale the collision object you have to do it with factories to create entirely new versions and then cleanup the old ones.

1 Like

Sure, I will go with this workaround for now, and look forward to the bug get fixed

1 Like

Yes, the new feature of dynamic scaling of physics is still in progress, but there were other tasks that needs to be completed first, in order for it to be robustly implemented. Currently, the ETA is still unknown.

3 Likes