behdad / box2d

Automatically exported from code.google.com/p/box2d
2 stars 12 forks source link

Static Bodies cannot be repositioned. #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a static body
2. Try to set its transform
3. Transform does not get updated (early return for static entities).

What is the expected output? What do you see instead?

I expect to be able to reposition static bodies.  This is key for making a 
dynamic live level editor or even controlling physics entities after they 
have been created.

What version of the product are you using? On what operating system?

r30 (found this after I ported r30 to Box2D.XNA)

Please provide any additional information below.

It seems like an arbitrary constraint to limit setting transforms on 
static entities.

I want zero-mass, zero-velocity body but i want to be able to set it's 
position/rotation after it has been created.  This comes up in level 
editor scenarios or even with our ZoomEngine entity system (we create the 
entity, which creates corresponding physics bodies, then later the 
position is set).  Kinematic bodies reduces the need for us to use static 
entities in many cases, but for the zero-velocity case we still want 
static, and want to reposition them sometimes.

In my port I removed this early return in Body.SetTransform and I'm back 
to the behavior I want without any negative effects on the rest of the 
system.

Original issue reported on code.google.com by NFurtwan...@gmail.com on 7 Dec 2009 at 2:17

GoogleCodeExporter commented 9 years ago

Original comment by erinca...@gmail.com on 7 Dec 2009 at 8:14