When is SIM_FROZEN ever triggered? I'm not seeing any descriptive documentation on the SIM_FROZEN is? Able to trap SIM_PAUSED but don't know how to trap or trigger a SIM_FROZEN?
I know SimObjects can be frozen but this seems to reference a more global SIM_FROZEN ... and how is it different from SIM_PAUSED?
Cheers, Rob.
PDK SIM_FROZEN vs. SIM_PAUSED?
- Rob Ainscough
- Posts: 3289
- Joined: Sat Jan 05, 2013 6:46 pm
- Location: Oregon USA
PDK SIM_FROZEN vs. SIM_PAUSED?
Rob Ainscough
- Rob McCarthy
- Lockheed Martin
- Posts: 3703
- Joined: Wed Aug 24, 2011 1:37 pm
Re: PDK SIM_FROZEN vs. SIM_PAUSED?
Hi Rob,
Sorry about the confusion with this event. This is currently used by SimOperator. To get the freeze state of any object using the PDK you can used the IBaseObject->GetMode function.
Regards,
Rob McCarthy
Sorry about the confusion with this event. This is currently used by SimOperator. To get the freeze state of any object using the PDK you can used the IBaseObject->GetMode function.
Regards,
Rob McCarthy
Rob McCarthy
Prepar3D® Core Lead
Prepar3D® Core Lead
- Rob Ainscough
- Posts: 3289
- Joined: Sat Jan 05, 2013 6:46 pm
- Location: Oregon USA
Re: PDK SIM_FROZEN vs. SIM_PAUSED?
Hi Rob,
Thanks for the response ... I suspected it was related to "SimObject" and not a more global event.
On a related question, I'm having NO LUCK getting the following to work:
// Trying to Unpause and/or Pause the sim
P3D::PdkServices::GetEventService()->SendMessageEvent(EVENT_MESSAGE_SIM_UNPAUSED, PVOID(0));
// using nullptr
P3D::PdkServices::GetEventService()->SendMessageEvent(EVENT_MESSAGE_SIM_UNPAUSED, nullptr);
The documentation references messageParam but that's it, there is no additional documentation to suggest what messageParam is other than it's of PVOID type ... so what am I supposed to be passing? I've search ALL the PDK samples and no instance of SendMessageEvent being used at all which in any sample code.
Modified from the WorldObject PDK sample ... when I hit P the event is trapped (breakpoint in code) and when I continue P3D unpauses for 1 frame then pauses immediately again:
Any help welcome.
Cheers, Rob.
Thanks for the response ... I suspected it was related to "SimObject" and not a more global event.
On a related question, I'm having NO LUCK getting the following to work:
// Trying to Unpause and/or Pause the sim
P3D::PdkServices::GetEventService()->SendMessageEvent(EVENT_MESSAGE_SIM_UNPAUSED, PVOID(0));
// using nullptr
P3D::PdkServices::GetEventService()->SendMessageEvent(EVENT_MESSAGE_SIM_UNPAUSED, nullptr);
The documentation references messageParam but that's it, there is no additional documentation to suggest what messageParam is other than it's of PVOID type ... so what am I supposed to be passing? I've search ALL the PDK samples and no instance of SendMessageEvent being used at all which in any sample code.
Modified from the WorldObject PDK sample ... when I hit P the event is trapped (breakpoint in code) and when I continue P3D unpauses for 1 frame then pauses immediately again:
Code: Select all
void WorldObjectPlugin::EventCallback::Invoke(P3D::IParameterListV400* pParams)
{
if (!pParams)
{
return;
}
UINT64 messageID = pParams->GetParameter(0).Value;
BOOLEAN simPaused = false;
BOOLEAN simFrozen = false;
switch (messageID)
{
case EVENT_MESSAGE_SIM_FROZEN:
// How to trigger? Not when sim is paused?
simFrozen = true;
break;
case EVENT_MESSAGE_SIM_PAUSED:
// Triggers when entering a flight from P3D scenario screen
simPaused = true;
// PVOID(0) ... still trying to trigger a event to pause or unpause sim ... currently not working, need to check PVOID paramters
P3D::PdkServices::GetEventService()->SendMessageEvent(EVENT_MESSAGE_SIM_UNPAUSED, nullptr);
break;
case EVENT_MESSAGE_LOADING_COMPLETE:
if (s_pWorldObjectPlugin->objectID == -1)
{
ObjectWorldTransform location = s_pWorldObjectPlugin->GetUserLocation();
ObjectLocalTransform locationOffset;
ObjectWorldTransform locationNew;
locationOffset.XYZ.X = OFFSET_DISTANCE;
P3D::PdkServices::GetObjectRenderer()->ApplyBodyRelativeOffset(location, locationOffset, locationNew);
P3D::PdkServices::GetWorldObjectService()->CreateObject(donkey_guid, locationNew, 2.0, TRUE, s_pWorldObjectPlugin->objectID);
}
break;
case EVENT_MESSAGE_APPLICATION_SHUTDOWN:
P3D::PdkServices::GetWorldObjectService()->RemoveObject(s_pWorldObjectPlugin->objectID);
PdkServices::GetEventService()->UnregisterCallback(EVENTID_Message, s_pWorldObjectPlugin->eventCallback);
break;
default:
break;
}
Cheers, Rob.
Rob Ainscough
- Rob McCarthy
- Lockheed Martin
- Posts: 3703
- Joined: Wed Aug 24, 2011 1:37 pm
Re: PDK SIM_FROZEN vs. SIM_PAUSED?
Hi Rob,
You won't be able to access this through the event service, this is mainly for listening to system events and calling a small subset events. For pausing you can either trigger the pause key event or use the ISimObjectManager to get the user object and trigger the pause event there.
Regards,
Rob McCarthy
You won't be able to access this through the event service, this is mainly for listening to system events and calling a small subset events. For pausing you can either trigger the pause key event or use the ISimObjectManager to get the user object and trigger the pause event there.
Regards,
Rob McCarthy
Rob McCarthy
Prepar3D® Core Lead
Prepar3D® Core Lead