Multiple collider for actor? #2453
Unanswered
pixelprodukt
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Ok, my bad. I thougt the ECS was some sort of optional thing, but as far as I understand, I should implement my own SensorComponent and a System for it and add it to the actor (or own entities). |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I recently found out about excalibur and wanted to give it a try. First impression is really nice but now I came to a point where I'm not sure if there's a reasonable solution already existing in excalibur.
Let's say I want to have an npc. This npc should have a normal collider, so the player can't pass through him. But I also want it to have another collider for a trigger for example. Let's say for a top down perspective and you come close to an npc and then an exclamation mark icon pops up over it's head and if you press 'e' or smth while in this 'sensor collider' you start talking to that npc. I hope it's understandable what I mean.
As far as I understand, an actor can only have one collider which also could be a CompositeCollider. But the CompositeCollider (or the actor itself) can only have one kind of collisionType.
And as far as I understand, every collider needs to have an actor.
So the first solution that came to my mind would be something like a class which holds several actors. One with the graphics for the npc and the 'movement blocking collisions' and another actor with the 'sensor collider'. But then you got somewhat of a problem adding this to the scene and also this meta class should provide some form of synchronization for the position of the actors meaning it would need it's own update loop etc. This would all be doable but it just doesn't feels right.
And maybe my idea with a 'sensor collider' isn't even that great, until now with other frameworks there was often a good, framework agnostic way to do this kind of things.
So I'm hoping someone has an idea or could hint me in a direction I may not be seeing?
Beta Was this translation helpful? Give feedback.
All reactions