Hi! New at UE dev!
I am currently trying to swing an axe at a tree in VR.
When I throw my axe at the tree, a hit event is registered and the axe will bounce off the tree. When I hold the axe (gripping), the axe will go through the tree and no event is generated.
My main concern is a HitEvent is only generated when I throw the axe and not when I hold it. How can it count when an object is being held?
To detect if an object is being held, you can use the grip button input events provided by the VR platform to determine if the player is currently gripping an object. When the grip button is pressed, you can set a flag indicating that the object is being held. When the grip button is released, you can clear the flag.
To prevent objects from going through other objects, you can use collision detection. You can add a Collision Component to your axe and set its collision profile to overlap with the tree’s collision profile. This way, when the axe collides with the tree, a hit event will be generated and the axe will not go through the tree. Additionally, you can also adjust the physics properties of the axe and the tree to fine-tune their interactions.
On my tree, I have physics enabled, overlap and hit events enabled, enable gravity, and block all collision. This blocked the axe from going through it, but the tree moved. I constrained the position and rotation, but then the axe goes through the tree.
Why does this happen?
And if collision is set to block all, why can any object I hold still go through it? If I throw something, it will bounce off with these settings.
The previous response works for detecting the collision, but it does not stop the axe from going through the tree.