Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Opened 15 years ago

Last modified 13 years ago

#286 new defect

WorldEntity scaling with physics

Reported by: rgrieder Owned by:
Priority: minor Milestone: Version 0.3 Codename: Castor
Component: Physics/ODE Version: 0.0.4
Keywords: Cc:
Referenced By: References:

Description (last modified by rgrieder)

When using physics, it is not possible to scale an object at the moment. The problem is that the Bullet physics engine doesn't support that kind of transformation natively. The main reason is that the collision shapes have fixed size. You create a sphere with radius 5 and it will have that radius as long as its lifetime.

But: You can apply setLocalScaling() to every collision shape. The implementation however is not complete. For instance for compound collision shapes, it has no effect. That inevitably means that we need to do some heavy work ourself. Imagine you want to scale a compound collision shape: You will have to scale each and every shape itself and even adjust the transformation.

There is more problems: SphereCollisionShape obviously does not support non-uniform scaling (or it won't be a sphere anymore). You will have to check every bullet collision shapes for its scaling capabilities and implement that in our framework. This can unfortunately only be done by examining the Bullet source code.

Update: I checked Bullet v2.77 (update is in the trunk since 04/27/11) and it seems to have scaling for compound collision shapes now. But haven't checked with the others. In short: our task may have gotten much easier!

Change History (5)

comment:1 Changed 15 years ago by landauf

  • Owner nobody deleted

comment:2 Changed 15 years ago by bknecht

  • Milestone changed from Version 0.2 Codename: Bellatrix to Version 0.3 Codename: Castor

comment:3 Changed 13 years ago by rgrieder

  • Description modified (diff)

comment:4 Changed 13 years ago by bknecht

Why do we have to be able to do scaling of worldentities? Is there any reasonable scenario where this could come in handy?

comment:5 Changed 13 years ago by rgrieder

  • Version changed from 0.2.0 to 0.0.4

Good question indeed. So far we haven't had problems at all ;)
However there is for instance somebody working on a shrink pickup right now.
Also, think of a more generic object that occurs in different sizes in the game. It would be really nice to have just one XML template for the collision shape and then apply scaling.
Also, what about "Hmm, I think this ship is too large..". It is quite tedious then to rescale the entire collision shape.
In general, content creation might be easier.

Note: See TracTickets for help on using tickets.