is there any way to make balls bounce around a room randomly, bounching off walls etc

is there any way to make balls bounce around a room randomly, bounching off walls, all different sizes etc

in the blueprints search for “Random” either Float or Vector
then feed these values into the Transform for “Spawn Actor”
Position, and Scale are Vector3, Rotation is a Rotator (you can feed a Vector3, or a Quaternion in to get the Rotator)
the direction of travel into like a Projectile Motion Component would also be a Vector3

after that let Physics takes over, just give them reasonable lifespans and look into object pooling if you are going to be doing this a lot.

thanks for the reply, im new to all of this uefn stuff. would it be possible to make it so when i shoot one it breaks into 2 smaller ones from that?

for Fortnite that would require making a custom Blueprint for the “projectile” (this would kind of be a thing anyways)

in the blueprint for the projectile

  • create an EventHit for the Actor (if it doesn’t have a collider well it should probably as the parent) and make sure that “Generate Overlap Events” for the collider is false
  • in the EventHit the arguement will be a pre-broken HitResult which you will probably be most focused on the Other (this is the Other Actor that was hit a wall or a character but will be an AActor* so will need to be casted) or the OtherComp (this is the Component of the other Actor that was hit this will be a UActorComponent* but typically the collider of the other Actor ) and if you want to do stuff with the direction of impact then HitNormal (for a physics refresher for the instigating actor this is the vector that is in the opposite direction to the impact, and would apply the force onto the instigator)

what to do as the result of the collision can get very specific to the situation, but in most cases will have Trig (typically stuff regarding Cosine as it is the most helpful) work done on it.

if you plan on doing multiplication unless you set a generation limit then you are creating a power function where Y=X^(n) actors where n is the multiplication, and each time an actor is spawned that is memory, and even doubling is powers of 2 (1, 2, 4, 8, 16, 32…) PLEASE set a generational limit somehow. Outside of game logic Rendering and Physics are Pretty heavy with high numbers of objects, and the system specs of fortnite are not that high.

thx so much any chance we could jump in a discord call so u could mayb screen share and show me how 2 do it to 1 ball could work out sending u some eth or money