swindy
July 3, 2017, 3:59pm
#1
Hi there,
I’m wondering what the syntax for the functions connectOnNewUser and connectOnLostUser?
From my understand, they work similarly to connectOnUpdate where you connect a function which is called on a user entering/leaving, however I can’t get the syntax right and I can’t see anything in the manual.
I was using the connectOnUpdate as a template which might be where I was going wrong
skeletonTracker->connectOnUpdate(std::bind(&ASkeletalTrackerComponent::OnSkeletonUpdate, this, std::placeholders::_1));
then the code for the two functions. OnNewUser and OnLoseUser are the names of the functions that I wish to call when the events happen
skeletonTracker->connectOnNewUser(std::bind(&ASkeletalTrackerComponent::OnNewUser, this, std::placeholders::_1));
skeletonTracker->connectOnLostUser(std::bind(&ASkeletalTrackerComponent::OnLoseUser, this, std::placeholders::_1));
Any help would be appreciated, thank you
swindy:
Hi there,
I’m wondering what the syntax for the functions connectOnNewUser and connectOnLostUser?
From my understand, they work similarly to connectOnUpdate where you connect a function which is called on a user entering/leaving, however I can’t get the syntax right and I can’t see anything in the manual.
I was using the connectOnUpdate as a template which might be where I was going wrong
skeletonTracker->connectOnUpdate(std::bind(&ASkeletalTrackerComponent::OnSkeletonUpdate, this, std::placeholders::_1));
then the code for the two functions. OnNewUser and OnLoseUser are the names of the functions that I wish to call when the events happen
skeletonTracker->connectOnNewUser(std::bind(&ASkeletalTrackerComponent::OnNewUser, this, std::placeholders::_1));
skeletonTracker->connectOnLostUser(std::bind(&ASkeletalTrackerComponent::OnLoseUser, this, std::placeholders::_1));
Any help would be appreciated, thank you
Hi! Sorry for late answer.
OnNewUser and OnLoseUser should have the following signature:
void (SkeletonTracker::Ptr, int)
Second parameter is user’s ID.
So correct code should be:
skeletonTracker->connectOnNewUser(std::bind(&ASkeletalTrackerComponent::OnNewUser, this, std::placeholders::_1, std::placeholders::_2));
skeletonTracker->connectOnLostUser(std::bind(&ASkeletalTrackerComponent::OnLoseUser, this, std::placeholders::_1, std::placeholders::_2));