hi everyone,
i found the solution for above if condition that was missing SUCCEEDED() function in this P3D sample code for Missile SimObject
error code
Code: Select all
CComPtr<IBaseObject> spOwner;
CComPtr<IBaseObject> spOwnerV01;
if( SUCCEEDED( GETSimOBjectManager()->GetObject(m_uOwnerId, &spOwner) )
&& [color=#FF4000]spOwner->QueryInterface(IID_IBaseObjectV01, (void**)&spOwnerV01[/color])
){
spOwnerV01->GetProperty("TotalVelocity", "knots", dParentVel, 0);
}
solved code
Code: Select all
CComPtr<IBaseObject> spOwner;
CComPtr<IBaseObject> spOwnerV01;
if( SUCCEEDED( GETSimOBjectManager()->GetObject(m_uOwnerId, &spOwner) )
&& [color=#00BF00]SUCCEEDED(spOwner->QueryInterface(IID_IBaseObjectV01, (void**)&spOwnerV01)[/color] )
){
[color=#00BF40]//Method 1[/color]
spOwnerV01->GetProperty("TotalVelocity", "knots", dParentVel, 0);
[color=#00BF40]//Method 2[/color]
[color=#FF4000]
int iPropertyCode;
int iIndex = -1;
int iUnitCode;
if(SUCCEEDED( spOwnerV01->GetPropertyCodeAndIndex(PROPRTY_TYPE_DOUBLE, "TotalVelocity", iPropertyCode, iIndex) ) && UCCEEDED( GetSimObjectManager()->GetUnitCode("knots", iUnitCode) ) )
{
spOwnerV01->GetProperty(iPropertyCode, iUnitCode, dParentVel, iIndex);
}[/color]
}
And also there is a problem with method 2 for getting TotalVelocity of Parent Object i do not understand why this is not working? But method 1 is working properly.
So now i want to get other simulation variables of Parent Object like :
Simulation Variable Units Settable * Multiplayer
FCS TARGETED OBJECT ID Number Y -
NUMBER OF ENGINES Number N -
GROUND VELOCITY Knots N -
ATC ID String (10) Y -
PLANE HEADING DEGREES TRUE Radians Y -
SIM ON GROUND Bool Y -
how this can be possible with GetProperty() function or any other way to get these variables?
Any one from LM..!!
Thanks