So we went with a using tags; however, we found two problems with this solution: support for querying tag in SC/lua and not able to have a drop down for tags. We came up with a gem that adds a few a new window to the editor that allows our designers to create tags, very similar to UE4 GameplayTags.
you could group your entities in collision groups and raycast to get specific collisions only.
Well i would have to include the level terrian into that group because if it hits only the level, than move to that point, it hits an enemy move to the enemy and start hitting it, if it hits an pickup, run to the item and pick it up etc
You could create collision groups and use collision layers to group the collisions.
https://docs.aws.amazon.com/lumberyard/latest/userguide/physx-configuration-collision-groups.html
Example Collision Group Configuration
The following example defines Player, Enemy, Bullet, Foliage, and Terrain layers, and the following collision groups:
- PlayerBullet – Collides with Enemy and Terrain.
- EnemyBullet – Collides with Player and Terrain.
- TerrainCollision – Collides with Player, Enemy, Bullet, and Terrain.
- PlayerCollision – Collides with Enemy, Bullet, and Terrain.
Thinking about it, maybe you could do a raycast, get the first entity hit. Then you fetch this entity (EntityId), and check the Entity type (could be some values you defined) and decide the action. Get the next entity if the first is not usable, and so on. Then you get entity position (may have to walk to the entity), then you act on what flag the entity has. Slash at entity if it is enemy or pick up if it is pick up entity. There are several ways to do this, you have to decide which is better for your game.
There are a couple of ways, the collision group path is good because it leverages information that's already part of the physics system, giving you finer contact filtering abilities. I have also seen the Tag system used, you set a Tag component to the entity you want to filter against and then on the raycast result you check if the entity returned has that Tag. This works, but it could be more cumbersome to work with as you'd have to test for that in every raycast.
Adding new answers, comments, and votes is disabled.
Relevant content
- Accepted Answerasked 3 years ago
- Accepted Answerasked 5 years ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago