I need help with a revolve joint creation behavior.

Valinor Games

  • Posts: 55
Hi, I am trying to make a game where you create a siege engine that you try to get to the end of the level.
I am trying to make it so I can design engines in the level editor, and I might eventually add custom engines.

The behavior I am working on right now is supposed to put a revolve joint between self (a wheel) and any boards it is on top of. It does this by creating a region, around self, and then checking for each actor of type structure, if actor of type is inside region, create the joint.

The problem is with the "if actor is inside region" block, but I don't know how to fix it. Does anyone know what's wrong?

Valinor Games

  • Posts: 55
Hey, I'm bumping this thread: does anybody know whats wrong?

colburt187

  • *
  • Posts: 2416
What is going wrong right now, I don't think you actually describe what the problem is?

For a test try moving the joint creation to a button press,
If spacebar is pressed,
If actor of type is inside region
create joint.

Valinor Games

  • Posts: 55
Sorry for not describing my problem enough. (That's not something you hear on the internet much.)

The code for creating the joint never runs, If I move it up to not include the "if actor is inside region" then it does run. Therefore the problem is with the detecting if the actor is inside the region. I know from the debug drawing that the actor is inside the region, but the program just isn't detecting it.

colburt187

  • *
  • Posts: 2416
Ok, well the first problem I think is the when created function only runs once, when the actor is created. Try moving it to an always event, then have a bool that stops it when the joint is created. So make a bool called joint created or something, then,
If actor is inside region and joint created = false
Create joint
Set joint created to true.

I think you may also have issues with where your joint will be created but let's get this first part working first.

Valinor Games

  • Posts: 55
Thank you! That works perfectly.