Motive API Questions

Post Reply
filwit
Posts: 1
Joined: Wed Mar 22, 2017 2:38 pm

Motive API Questions

Post by filwit »

Hi folks, I'm using the Motive API and came across a rather confusing part of the documentation in the code examples for TT_RigidBodySettings and TT_SetRigidBodySettings.
  • It's unclear why a custom cRigidBodySettings constructor is needed. There is no explanation given for why no default constructor exists in the NPTrackingTools.lib, or what purpose providing your own constructor serves. I can only assume it was intended to be used to set app-specific RigidBody property defaults.
  • Without a default constructor, the state of an cRigidBodySettings instance is undefined. Which means you must fist initialize the instance via TT_RigidBodySettings. Or, to explicitly set each member of the cRigidBodySettings instance.. but even then you'd still normally need to use TT_RigidBodySettings in order to load the corresponding mName/UserData/etc of the RigidBody you're trying to configure. All of which kinda destroys my original assumption about the purpose of not providing a default constructor in the Motive API.
  • The code example for TT_SetRigidBodySettings is especially confusing because the integer rbcount is being declared before the constructor, but used in the code after it. The example code seems to depict a scenario where the for-loop appears directly after the constructor, which is obviously not something that would compile. And calling TT_RigidBodyCount in global scope prior to TT_Initialize probably wouldn't do anything useful either. Is that code a "typo"?
So I'm curious, why is no default constructor included for cRigidBodySettings?

Unless I'm missing something obvious, I would recommend improving the code examples on that part of the API to be more clear about why no default constructor exists, what purpose making your own serves, and where to define it. Ideally it would be nice to have a default constructor included in the NPTrackingTools libs.
joe.lee
Posts: 55
Joined: Thu Nov 12, 2015 10:57 am

Re: Motive API Questions

Post by joe.lee »

Hello filwit,

First of all, I apologize for the late response and thank you for your feedback.

To answer your question, the absence of the default constructor was not intentional. It must have been missed when the rigid body settings class was added to the NPTrackingTools library. It was probably not caught under the radar until now because most of the users create and configure the rigid body definitions in Motive and export them for use in the API. We will have this addressed and included in the NPTrackingTools library on the upcoming release of Motive.

In regards to the sample code being ambiguous. the sample code only highlights lines that are relative to the given function. It was assumed throughout the function references that the library was already initialized and set up in the other parts of the code. I understand this was also confusing in addition to the default constructor getting defined at the top. The API documentation is pretty new and we are looking forward to improving it more.

Again, thank you for your feedback, and please let me know if there is anything else I can help clarify with.


Thank you,
Joe
NaturalPoint | Customer Support
logonado
Posts: 1
Joined: Mon Jul 24, 2017 2:25 am
Location: Brisbane, Australia
Contact:

Re: Motive API Questions

Post by logonado »

Such a great post to know different useful information.
Post Reply