Hello. I have two HUDs, one to display the Player's object variable HP, and one to display the HP value of whatever object is currently the "Selected Object," either enemy or Player. The Makinom menu setup for each is exactly the same, except for two things: 1) the "HUD User" for the Player HUD is "Player" and for the Selected Object HUD is "None." 2) The "Game Object" for the Object variable source is "Player" for the Player HUD, and "Selected Object" for the other. The result is the Player HUD displays correctly, but the Selected Object HUD always shows zero as the HP variable value, whether I've selected the Player or enemy. The selection of the objects is registering because I can see the cursor object above the selected object, and the HP variables on Player and enemy can be reduced by collision impact, so the issue seems to be my menu set-up. How do I make the HUD show the current HP of a selected object?

Also, another question about selected objects.....remind me how can I exclude certain colliders from the mouse click that "selects" an object? I want only the Mesh collider on one object in the Hierarchy to trigger the selection, but not--for example--the large trigger colliders I have attached to other child objects throughout the Hierarchy.

Thanks for any advice!
  • edited July 15
    I'll look into the first issue - I think it's due to the HUD not updating when the selected object is changed.

    As for the other question, clicking to select an object looks for the SelectableObject component in the game object that was hit by the raycast and any of it's child objects, i.e. you should place the component on the one with the mesh collider and have the large trigger colliders be child objects of it or separate in the hierarchy, e.g. both being childs of the same (non-collider) parent object.
    Also, using the Layer Mask setting and having the large triggers not being checked by the raycast for object selection is a solution for this :)
    Post edited by gamingislove on
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Ok...I'm still having trouble. Here is the setup:
    I have an object (a spaceship hull) with a mesh collider, kinematic rigidbody, and selectable object component. There are separate child objects attached to the hull object. First, a shield object (with kinematic rigidbody and mesh collider) for projectile collisions, which is larger than the hull and encompasses the hull object completely. Second, a weapon muzzle point that has a box collider set to "is trigger" that stretches out from the space ship, and triggers the weapon to fire when an enemy enters the trigger. Only the hull object has a selectable object component.
    Here are the results:
    When I disable the shield and weapon muzzle objects, and click on the hull, it is selected correctly (the selection cursor appears as it should). When I activate the shield, and click on the ship, the shield is larger and is the first object hit (not the hull). No selection registers, and that fits your description--the shield does not have a selectable object component (only its parent does) so nothing should happen. But when I turn on the weapon muzzle box trigger collider, and click on the invisible place in space where it extends, it triggers the selection, even though the muzzle object has no "selectableObject" component, and I'm not anywhere near the hull object with my "click." Why does the box collider trigger child object trigger the selection, and not the shield's mesh collider, when both are direct children of the hull? To make matters worse, I put both the shield's mesh collider and muzzle's box collider on the "Ignore Raycast" layer, and unchecked the "Ignore Raycast" layer in Makinom's Base/Control "cursor raycast" setting, but the shield still blocked the selection from hitting the Hull, and the weapon muzzle box collider still triggered the selection.

    Any thoughts as to what may be happening?
  • HUDs not updating will be fixed in the next update, there'll be an option in HUDs to update when the selected object changed.

    Will look into the other thing.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.