2 physics bodies following each other

I’ve tried all that and been using prints,

if (agro.type == 1 and event.element1 == 1) or (event.element1 == 1 and hit.type == 1) then    print("HIT Boss HEAD :)")    print(event.element1)    print(event.element2)    print(event.object1)    print(event.object2) end if (agro.type == 1 and event.element2 == 2) or (event.element2 == 2 and hit.type == 1) then    print("HIT Boss")    print(event.element1)    print(event.element2)    print(event.object1)    print(event.object2)  end   

I’ve even tried to print out the variables outside of collision just at the start and its all nil

print(game.mboss\_1.element1) print(game.mboss\_1.element2)

Still all registers on one body…for the element1

I’m using a normal collision handler for weapons being:

Runtime:addEventListener(“collision”, weaponCollision)

[quote=“Azmar,post:21,topic:327779”]

I’ve tried all that and been using prints,

if (agro.type == 1 and event.element1 == 1) or (event.element1 == 1 and hit.type == 1) then print("HIT Boss HEAD :)") print(event.element1) print(event.element2) print(event.object1) print(event.object2) end if (agro.type == 1 and event.element2 == 2) or (event.element2 == 2 and hit.type == 1) then print("HIT Boss") print(event.element1) print(event.element2) print(event.object1) print(event.object2) end

I’ve even tried to print out the variables outside of collision just at the start and its all nil

print(game.mboss\_1.element1) print(game.mboss\_1.element2)

Still all registers on one body…for the element1

I’m using a normal collision handler for weapons being:

Runtime:addEventListener(“collision”, weaponCollision) [/quote]

Print the elements outside of those “if” statements, for several reasons.

For a 2 part body, you should see 1 and 2 respectively, not necessarily in that order

Hi @Azmar,

You may be confused by what the “elements” are. “element1” should be the boss, and “element2” the other object… not the individual elements within the boss. So, the boss, as a whole, is always “element1”, and in a global collision handler, the value it returns will indicate which element of the boss was collided with.

Brent