cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a HUD, or wrist-mounted buttons?

Greekanadian
Level 3

So I've been messing around in horizon worlds creation tools to see what kind of functionality they have.

 

I wanted to experiment making a sort of activatable chair, which I did by doing the following:

 

  • Modeled a chair with collision enabled by default
  • put a spawn point in the chair
  • built an invisible box around the chair with collision disabled by default
  • put a "button" (a squashed red cylinder) on the corner of it, with a trigger gizmo around it
  • when you touch the button it respawns you in the chair and then turns that invisible box's collision on (making you confined to the area of the chair)
  • put an "X" on the other corner of the chair with another trigger gizmo
  • set that trigger to disable the invisible box's collision, and enable the chair's collision (which effectively "ejects" you out of the chair

This seems to all work fine, however I would much prefer the interaction with the chair to be easier. More like walk up to the chair and a little button pops up in front of your face to sit in the chair.

 

When while you're in the chair there could be a little X attached to your hand or something like that where when you hit it, you'll be ejected from the chair.

 

Instead of the buttons being on the chair itself.

 

There aren't very good online resources for building scripts within horizon worlds, and the official ones found within the game are honestly not very good.

 

I tried doing something like making a cube, flattening it, then telling it to move to the player's head position when the world starts but that doesn't work for some reason.

 

Anyone built anything like what I'm talking about?

 

6 REPLIES 6

TrendMasterG
Level 2

Did you find out how to make a sitting down script/model? I’ve just started in horizon worlds and I’m coming from building in roblox. In roblox you can walk up to a seat block (provided by roblox) and you sit down. When you want to leave you jump up. There is a jump button on the quest controller. Could you do something like that?

Creating a seat block makes sense. Then you can duplicate it and use it for other chair models. I don’t know how to make one yet but the basics of it would be

seat block - when touched by a player, the player locks in to a sitting position (lowered and not able to walk)

Exit block - when the player presses the jump button they exit the block.

Chair models - non-colliding 

The seat block would also have to be transparent 

To have a button(hud) float by your hand. Have the script set to local and would be like below.

 

onWorld Start

   Set owner to ownerOfObject(self)

onUpdate:

if(owner != server player)

   moveTo(self, positionOfhand + offset)

else

   move it under the chair or hide it. will only happen when the server owns it.

 

Since it is running local, you will not be able to listen to events from the triggers you have on the hud. So you can either have another script running on the trigger, that detects if the user pressed a button on the hud. Or you check the distance to each button in the on update loop to see if a button pressed should happen. 

 

When someone sits in the chair assign the ownership of the hud to the user and like magic it should show up by their hand. When they leave the chair set the owner back to server and it will hide or get position under the chair.

Also, you do not need to use an invisible box to prevent the player from moving. Just set their speed to 0. 

For the chair the seat part should not have collision, then it will look like your sitting in it.  

Thanks for the reply. I stopped using this months ago though because horizon worlds is terrible and massive waste of time. 

TrendMasterG
Level 2

That’s a shame. Just in case anyone else reads this I think lowering the player is better than having them the same height as a standing player. Also if you think how you act when you’re in a seat, you don’t walk away until you need to, so I wouldn’t even set the player speed. If they want to pretend to sit down then they won’t be moving anyway. When they want to leave, they leave the seat block and their height adjusts to the standing height.