OrfeasZ / ZHMModSDK

A modding SDK for Hitman 3
Other
109 stars 27 forks source link

How do i deselect a object in debug mode #117

Open thatguy9090 opened 2 months ago

thatguy9090 commented 2 months ago

i love using the mod just for messing around and throwing 18 bombs in to a room and watch it go boom but when i click a object to move it, rotate it and resize it and cant deselect. i pressed EVERY SINGLE BUTTON AND COMBANATION and it still wont go away so could you PLEASE tell me what keybind it is or if you havint added it please add it

Vabix commented 1 month ago

unfortunately the only method for now is just clicking something else

ExileIsland commented 1 month ago

I see where "[Editor] Deselect entity on backspace." is listed on 2.0 rc.1 Is this referencing something else? Would really enjoy being able to deselect objects, or at the very least, have their hitbox / outline disappear once the SDK menu is closed out with tilde key.

ExileIsland commented 2 weeks ago

Just bumping this again for a little support. Is anyone checking these reports/questions? Love the work y'all done, makes a great game even more fun. I love causing chaos with this system. Just not sure if anyone has been home lately to check things out and makes some updates. :)

OrfeasZ commented 1 week ago

The debug mod doesn't currently have a way to deselect entities. I'm not sure if there's even a reason for it to be able to select them now to begin with, given the existence of the Editor mod. Will have a look when I get a chance.

bababoi-2 commented 1 week ago

An easy solution would be to just null the selected entity in the OnMouseDown function in DebugMod.cpp

Deselect when clicking on the selected item:

if (s_RayOutput.m_BlockingEntity)
{
    const auto& s_Interfaces = *s_RayOutput.m_BlockingEntity->GetType()->m_pInterfaces;
    Logger::Trace("Hit entity of type '{}' with id '{:x}'.", s_Interfaces[0].m_pTypeId->typeInfo()->m_pTypeName, s_RayOutput.m_BlockingEntity->GetType()->m_nEntityId);
}
- m_SelectedEntity = s_RayOutput.m_BlockingEntity;
+ m_SelectedEntity = s_RayOutput.m_BlockingEntity == m_SelectedEntity ? nullptr : s_RayOutput.m_BlockingEntity;

Deselecting when clicking in the sky should be possible by nulling the selected entity if the raycast failed

if (!(*Globals::CollisionManager)->RayCastClosestHit(s_RayInput, &s_RayOutput))
{
    Logger::Error("Raycast failed.");
+   m_SelectedEntity = nullptr;
    return;
}

I haven't looked into it too much, but that works for me