PDA

View Full Version : How to interpolate position of Entity and its children



BigBMan
01-23-2011, 04:45 AM
I'm trying to create a button bar on the bottom of the screen with the following Entity (simplified) layout:

MainScreenEntity
- ButtonBarEntity
-- HeadingBarEntity (RectRenderComponent)
-- BackgroundEntity (RectRenderComponent)
-- Button1Entity (Button2DComponent)
-- Button2Entity (Button2DComponent)
-- Button3Entity (Button2DComponent)

I'm trying to move it towards the bottom of the screen with the following code:

AddFocusIfNeeded(pButtonBarEntity);
ZoomToPositionEntity(pButtonBarEntity, CL_Vec2d(rectBar1.left, rectBar1.bottom - controlHeight), 3000, INTERPOLATE_SMOOTHSTEP, 5000);

But it does nothing. Does this not move all child Entities as well? How do I make sure all children of pButtonBarEntity move as well?

** UPDATE **
It does work using SlideScreenVertical so I guess I'll just use that on my Entity.

** UPDATE **
Turns out I need to have the size2d and pos2d variants defined, which means I need to calculate those before calling either function. Works now!