Okay, I'll take the gravity problem out of the equation -
getChildren () returns a constant reference to a list of all children. How do I navigate this list, access individual nodes in it?
Acessing Children - A simpler question
-
- Posts: 37
- Joined: Fri Jul 02, 2004 5:36 pm
- Location: Albany, NY
- Contact:
Acessing Children - A simpler question
------------------------------------------
A monkey poured coffee in my boots.
------------------------------------------
A monkey poured coffee in my boots.
------------------------------------------
With an iterator
Check API documentation for irr::core::list<T> and irr::core::list<T>::iterator.
Basicly it would look like this (I'm assuming you have a list of ISceneNodes, same rule applies to other classes):
I'm not 100% sure about this (I've only seen a friend of mine do this but that's how it should generally by done.[/quote]
Basicly it would look like this (I'm assuming you have a list of ISceneNodes, same rule applies to other classes):
Code: Select all
irr::core::list<ISceneNode>::iterator i;
i = MyRootNode->getChildren().begin();
while(i != MyRootNode->getChildren().end()) {
// do something (*i is the list element)
i++; // advance the iterator to next item
}
Cinek