Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 20 Mar 2013
Offline Last Active Nov 29 2013 06:31 AM

#5045899 How do you handle entities which have a parent of a different type?

Posted by on 23 March 2013 - 04:33 AM

For instance if I set an entity to be the parent of another entity and then polymorphically create one to be a PhysicsEntity and the other a RenderEntity, should this even be allowed?Because right now each UpdateForParent the RenderEntities cast their parent IEntity to a RenderEntity, take its transform and use it to calculate the transform of the entity.Not sure how to implement the PhysicsEntity into this tho.Maybe when a PhysicsEntity has a RenderEntity child, it should turn the centerof the bounding volume into a transform matrix and use it to affect the transform of the child RenderEntity and when it's a PhysicsEntity being a child of the RenderEntity, to create a transform from the center of the bounding volume of the PhysicsEntity and offset it by the parent's transform matrix?Or is it better if I just make it assert(parent->GetType() == this->GetType()); ? Which would make things easier but disallow some flexibility.