Items Jumping Out of Chest
Hello. In my game; when player opens a chest, I want random items jump out of that chest and don't collide. Like in Fortnite of Epic Games.
What would be the best way to do it? With a projectile movement maybe? Though I don't know how to do that.
Thanks in advance.
asked Oct 09 '17 at 01:46 AM in Blueprint Scripting
I would use Add Impulse to launch them: https://docs.unrealengine.com/latest/INT/BlueprintAPI/Pawn/Components/CharacterMovement/AddImpulse/index.html
Then use three Random Float in Ranges to generate some vectors with x and y between like -0.25 and 0.25 with a Z of 1.0. This will shoot them up at angles near but not exactly vertical: https://docs.unrealengine.com/latest/INT/BlueprintAPI/Math/Random/RandomFloatinRange/index.html
The Launch Multiplier is just an easy to control how high your loot launches.
Then create a new collision profile and channel so the loot only collides with the ground (WorldStatic) or whatever. https://docs.unrealengine.com/latest/INT/Engine/Physics/Collision/HowTo/AddCustomCollisionType/index.html
Depending on what you're going for, Set Velocity could be used in place of Add Impulse, or you could set up a level sequence that controls their bounce more precisely. But Add Impulse sounds like the best fit from what you said above.
answered Oct 11 '17 at 01:30 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here