Closed GoogleCodeExporter closed 9 years ago
I'm not entirely clear on what's going wrong here -- do you have some example
code that reproduces the problem?
Original comment by lieseg...@gmail.com
on 4 Jan 2013 at 5:37
void ScreenTest::Start()
{
m_sky = new CloudActor("Resources/Images/clouds2.jpg", "Sky"); //derived from Actor
m_ground = new GroundActor("Resources/Images/floating1.png"); //derived from Actor
m_arth = new CharActor(GetBitmask("Resources/Images/animations/chars/arth/arthBitmask.png")); //derived from PhysicsActor
if(m_arth->GetBody() != NULL){
m_arth->GetBody()->SetUserData((void*)m_arth->GetMask());
std::cout << "data: " << static_cast<Bitmask*>(m_arth->GetBody()->GetUserData())->getPath() << std::endl;
}
//theWorld.BeginContact();
theWorld.Add(m_arth, "Front");
theWorld.Add(m_ground);
theWorld.Add(m_sky);
//Game housekeeping below this point.
#pragma region Game Housekeeping
_objects.push_back(m_sky);
_objects.push_back(m_ground);
_objects.push_back(m_arth);
#pragma endregion
}
the code above is the essential part but I've attached the real file
the std::cout seems to be correct but after a seconds or so I get a
std::length_error now...
Original comment by maliusa...@gmail.com
on 6 Jan 2013 at 4:19
Attachments:
The body's userdata needs to be the Angel actor that it's tied to. That's how
it receives draw updates from the engine itself. You shouldn't change the
physics body's userdata. If you need to store extra data for an actor, you can
store it on the actor itself.
Original comment by lieseg...@gmail.com
on 6 Jan 2013 at 8:13
can i set the userdata to point at a class derived from physicsactor, then?
Original comment by maliusa...@gmail.com
on 7 Jan 2013 at 2:26
If you derive a class from PhysicsActor, the userdata will already be pointing
at it as its set during PhysicsActor's constructor.
Original comment by lieseg...@gmail.com
on 7 Jan 2013 at 3:47
great thanks
Original comment by maliusa...@gmail.com
on 7 Jan 2013 at 3:49
Original issue reported on code.google.com by
maliusa...@gmail.com
on 3 Jan 2013 at 5:52