Forum Discussion
4 Replies
- Ben.SHCommunity Manager
Have you taken a look at this Throwing documentation to ensure you have the grabbable object properties configured properly? There is also an example code as well in that article.
- starpool108Member
I will continue to try and figure this out. I haven't encountered "enable throwing controls" when I attempt this, but have seen it before on shared assets. I have yet to use typescript.
- Exo_GuidMember
If you hold the default drop button until the green ring completes you'll throw the object held. I'm working on this as well and will post when I get it figured.
- Exo_GuidMember
Hi Ben, I've tried to follow the Throwing Documentation and have had the Desktop Editor crash multiple times. Typically after multiple grabs of the same object (DiceWhite_geom from public assets). It does manage to throw once. Throwing controls is enabled. I've filled a bug report and included the Windows Event application error. Here's the code I'm using stripped down after multiple attempts:
import { Component, CodeBlockEvents, PlayerDeviceType, Player, Handedness } from 'horizon/core'; class DiceThrow extends Component<typeof DiceThrow> { static propsDefinition = { }; start() { this.connectCodeBlockEvent(this.entity, CodeBlockEvents.OnIndexTriggerDown, (player: Player)=> { // Ignore on VR devices if (player.deviceType.get() == PlayerDeviceType.VR) { return; } // Setup the throw options let opt = { speed: 25, pitch: 30 } // Calling Throw Held Item player.throwHeldItem(opt); } )} } Component.register(DiceThrow);