Today I played around with dropping granades. I decided to ditch dangling granade with PhysicsConstraint for now, because it caused many problems, such as:
- granade's weight impacted drones flying and I didn't know to to fix it
- granade hitting a ground with a force with rotation also applied it to a drone making it behave unstable
- didn't know how to instantiate the granade so that it would also be connected with PhysicsConstraint
- PhysicsConstraint always needs to have 2 elements it needs to be connected to.
Right now I decided to spawn a granade without physics and then when dropping it would enable physics. I created a small sphere below my drone, which is visible only in the editor. Then I took its location and spawned an Actor from a BP_Granade and saved its reference to a variable. Then when dropping a granade I would access that saved reference and call a function "Release()". I also listen on the "On Exploded" event, so that I can set the reference to null.
Well, there is one little problem - the granade is not attached to a Drone. Need to figure it out.
Top comments (0)