Make ai know if an object is grabbed in unreal

First please consider i am a beginner :slight_smile:

I’trying a simple game where the player and the ai can grab(with physicshandle) any physic object and launch It. Tio find the object the ai makes a sweep multyby objecttype and chooses a random object. Than the BB variabile is updated and so on.

But this way the ai will try and pick Also the physic object that is altready taken by another pawn.

I can’t think of a way to avoid It other than making a calss for the physic object with some variabile in It, but than i should check it every tick and cast It.

Now i’m shure there is a much better way, Isn’t It?

I’m a Unity student so bear (bare?) with me if I use the wrong terms.

But theoretically, if you don’t want to add a script to every object, you could have a centralized gamemanager keep a List of grabbed objects. When an object is grabbed, a reference to that object is checked against the references to the gamemanager’s list and the grab is cancelled if there is a match.

When you grab an object, report it to the game master so that a reference to that object can be added to it’s list. When you let go of an object, report it to the game master so the reference can be removed from the list.

Thank YouTube very much. I’ll try. Can It Be ok to do that using delegates? If they are called the same in unity

I don’t see why nott. Delegates should work fine.

Privacy & Terms