Download

BoxOverlapActors issue! How to move/rotate an actor after overlapping??

I’m struggling in doing this!
I’m using BoxOverlapActors and I get an array that can be read using ForLEachLoop. I’m trying to rotate, move and apply Physic to each overlapped actors but there is no way!
Actor retrieved from BoxOverlapActors are incompatible with any other functions that requires a target!!
So how can I please do that?

The array that comes out of that node, is an array of actors. Actors and sort of the ‘highest’ part of the inheritance hierarchy, so you’ll need to cast to the thing you want to operate on…

Well that’s what I did. It works using “SetActorRotation” but nothing if I wanna change material or apply SetSimulatePhysic!
What’s wrong?

Casting to StaticMeshComponent got error:

castto.jpg

You can’t do ‘SetMaterial’ on an actor. You need to have a ‘thing’ the system actually knows, so cast the actor to the thing you want to set the material on.

Sorry, your pic only just appeared: you have to cast to the blueprint or actual mesh first.

you have to cast to the character after the loop… like has been said already

What are these actors actually?

plus you might have to do an equals after the loop to ensure the overlapped actor is the character you want…

Ok please let me explain you better the code.
Imagine to destroy an actor, then delete item in an array. Now the code “scan” all the actors around it as a 3d grid. For each of those it has to set the physic.
So this is already the Blueprint you know?

These actors are the BP_Cube that you can see on the left side of the screen. It’s the same Blueprint. All actors are procedurally generated based on an array. But the point is: I need to apply physic to all the actors Overlapped using BoxOverlapActors, so how can I dot that?

why dont you do it the other way around, make the procedurally created actors have an overlap, and then make them get physics if they bump into that one?

that’s what I’m doing man, but the problem is that however I need to apply physic only to a certain numbers of actors “found” using boxOverlapActors. So once I have these actors I need to apply physic

Using CastTo StaticMeshActor instead , and tergting to the StaicMesh I have no error but nothing happens.! How so can I do it?

if you are doing the overlap on each individual actor, then you dont need a for loop…

do an on begin overlap, and cast to the actor that it is supposed to overlap then do the physics thing… you cant put procedurally created actors into an array, unless you are even ticking “get all actors of class” in each and every procedurally generated actor and that will not be performant at all…

you dont need to pre-specify which actors they can overlap. do an overlap check and that is all,…

No no ok man, so forget the array. Just have a look at the picture. I’m using a BoxOverlapActors, so I just need to change properties to all the objects “captured” by BoxOveralActors,this is my question :slight_smile:

What Mindfields is saying, is make the individual BPs so they set their own physics when they overlap with something. That way, you don’t need that central code at all…

This is the problem: I cant set their own physics because they are too many and in relation with them, that’s why I have to set the physic only to some certain objects and only once something is happening.

Something like this?

no in that case the player interact with a single actor.
In my case I have a cube actor that has to set properties of other actors around with the same class