How do I detect a specific collision

Get help using Construct 2

Post » Sun Nov 23, 2014 7:13 pm

Hey all,

I have some compound objects that make up a character. Part of each character is a physics object and a ground detector. I use the ground detector to detect overlaps in solids and upcoming collisions. The problem I have is that I need to be able to use the ground detector and ask if I am colliding with a physics object. That way if one character stands atop another he can jump off/know if he is on the ground.

I keep the physics object uid in a variable called "MyCollider" stored in the object ground detector.

I basically need to be able to find out if I am overlapping any physics objects that belong to characters but not read the one that belongs to the current character (the ground detector is always overlapping the physics object that makes up the character)

does this make sense?
Image
B
33
S
11
G
2
Posts: 563
Reputation: 5,141

Post » Sun Nov 23, 2014 7:17 pm

You might want to try using instance variables and set their values to true/false. then check the value before executing the overlap logic.

Alternatively, this might be where you can use families as well and put the physics objects you want to process in a family.
B
7
S
1
Posts: 13
Reputation: 363

Post » Sun Nov 23, 2014 7:41 pm

They are in families. Everything I make is always in a family, except for debug objects and such. All characters in the game (player controlled, and ai) have a physics object that is in the family Character_Coliders. Each Ground detector for every character in the game is of the family Character_StateManager. This manager controls numerous objects that check nearby for walls, cieling, and floor. It also runs some ray-tracing if needed.

Long story short I run the following logic:

For each Character_State...
is overlapping (any object that should be solid including character coliders)?

The problem is that will always be true because the state is overlapping its own objects collider. I need to somehow obtain a list of objects that it is overlapping and if it is only overlapping 1 object I can see if that objects uid matches the stored uid of the collider belonging to the character. Iv tried but somewhere the subtleties of the list of objects construct 2 selects has escaped me. I could program this in a heart beat but I can't seam to event script it.
Image
B
33
S
11
G
2
Posts: 563
Reputation: 5,141


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests