Attaching an entity to a compound entity

Hi I am making simple turret entity that if you stand in front of it it kills you but the turrets collision is compound making the death barrier part of it’s body witch is an issue due to the death barrier no longer working.

Thanks for your time
William Boersma

show the code, and please i dont understand what your pointing out

@jus.co_ding_me_23 it’s not code i just need to make an entity attach to a compound entity without it becoming part of the compound entity’s collision.

@will This is an interesting use case where someone wants a trigger on a compound physics object. Besides making it follow the entity every frame and not having the trigger as a child, is there something we can do here?

well, even if you dont need code, i recommend getting the position of the entity you want to attach the other entity to.
i do it like this.

whateverScript.attributes.add("compoundEntity", {type: "entity"});
whateverScript.attributes.add("attachment", {type:"entity"});

whateverScript.prototype.update = function(){
var com = this.compoundEntity.getPosition();


I hope it helps, because i dont have any other solution and parenting will not work because it is in the same collision


your welcome

be sure to parse the script and choose the compound and attachment entities.

@jus.co_ding_me_23 it didn’t work it just killed sent the enemy (the compound entity) to the respawn point and killed me if i stand in front of it or behind(it’s only supposed to kill you if you stand in front)

i have no idea how to work around that, cant you alter the enemy so it is supposed to kill in front or back and you have to jump over it or something

what did you make the attachment entity be?

can i do something like this?

var ey = com.y - 0.833;

yes, but like this

var ey = this.compoundEntity.getPosition().y;
ey - 0.833;

your method still works

maybe it will work, i have done something similar before


does it work and pls show me the project

@jus.co_ding_me_23 it works but it won’t follow the rotation
is there any way I can fix that?
you asked to see the project.

well there are stuff like getRotation() and setRotation(). You could use those.