Scaling Collision Object when Game Object is scaled (DEF-521)


#1

I have created a platform(as a game object) that is to be used as a building block throught out the whole game. The problem is that the collision object associated with the platform does not scale when the platform is scaled in the collection file.The sprite scales as required but the collision object stays the original size. This is creating a problem. According to me when a game object is scaled, all children elements should be scaled accordingly.


Changing size of an object
Making a Rogue-like game in Defold
TileMap Collision Scaling
Physic body scale issue? (DEF-521)
Big list of feature requests based on our experience on Ludum Dare
Cutting objects and letting them fall "naturally"
Big list of feature requests based on our experience on Ludum Dare
#2

Bump! No input on this?


#3

We’ll look into this. Thanks.


#4

I found an issue on this in the backlog. I’ll see if it can be prioritized.


How do you dynamically scale collision object and/or dynamically remove part of a spine scene with script
How to set size of collision object by script
#5

I just encountered this problem as well.

The collision objects do however get scaled if you specify a scale with factory.create, but not when you do it via go.set_scale.

Maybe bump this up to a bug instead of a question?


#6

I’ve attached a Jira ticket id and moved this to bugs.


#7

Is there any update on this bug? Ive just ran into this as well. Ive tried setting game object scale with factory.create and go.set_scale and neither set the attached collision object shape scale.

Whats the work around for this at the moment? I know I could manually set the Box Shape width and height in the editor, but could I access the Box Shape’s width and height from the parent game object?

Thanks,
Jacob


#8

any news here? or atleast an idea for a workaround?


Random geometric shapes
#9

There is no general workaround that I know of but there might be for specific use cases.


#10

I was in the middle of typing a post on this then this thread came up under similar. The problem seems to be that the orange outline for the collision object does not scale up or down when the game object is scaled. However, when the game is run the collision object is scaled.


#11

Any news on this? It’s pretty huge to not be able to scale the collider with the GO.


#12

No new news I’m afraid.
It was considered some time ago, but turned out to be more complex than what was initially thought.
Since the community is still requesting this, it will increase in priority.
However, I cannot give you an e.t.a. at this point.


#13

This bug blocks fast prototyping, when you don’t want to use tile map. ):


#14

I’m missing the ability to dynamically alter my collision object size too. For example i want to create a shockwave which expands and hits objects at it’s border.


#15

There is an existing workaround to get scaled collision. You must create new objects based on factories with a set scale. Then you delete the older. And need something to manage the creation / deletion based on scaling. Or keep the various scales and only disable / enable their collision sizes as they are needed if you have only so many possible scales. Obviously is messy, but if you need dynamically scaled collisions this is a way right now. Works with factory / collection factory.

    collectionfactory.create("#groundfactory", go.get_position("."), go.get_rotation("."), {}, 2)
    collectionfactory.create(url, [position], [rotation], [properties], [scale])

Set_scale on collision objects?
#16

Regarding scaling of collision objects through factory.create;

Right now it appears that scaling is applied when using a number as scale parameter - but not when using vector3?


#17

Yes. you can use vectors to scale. Collisions will not scale along unless the scaling is uniform though:

factory.create(component, p, nil, {}, vmath.vector3(8, 1, 1))

factory.create(component, p, nil, {}, vmath.vector3(8, 8, 8))


#18

I understand not being able to non-uniformly scale spheres, none of the other engines I’ve tried have allowed that, but scaling boxes would be great. Or at least some way to create and add a new box shape of different proportions. That seems to be the one thing you can’t work around right now.


#19

The workaround is that if the scale-factor is uniform along all axes (x, y, z), then the collision object seem to scale correctly. I encountered the same issue with scaling sprites and connected trigger object.

This is mentioned by @sicher a bit down the thread, but not explicitly mentioned as a workaround for the issue, so…
Am I missing something?


#20

Yes, I meant there’s no workaround for non-uniform scaling.


Collisions are ignored (SOLVED)