How do you tell the difference Level entity and other entities

0

I am currently trying to work on this SC graph that raycast to hit the level or another entity, and do something based on that entity. I am assuming that the Level is itself an entity, because I get entityId for an entity that does not match any of the entityid of entities in the entity outliner. My questions is how can you tell from SC that from the entityid, how to tell the Level Entity from others entities? I tried to use Find Component Of Type and see if that entity has the PhysX Terrain component but cant create a Uuid in SC.

已提問 4 年前檢視次數 191 次
6 個答案
0
已接受的答案

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.

已回答 3 年前
0

you could group your entities in collision groups and raycast to get specific collisions only.

已回答 4 年前
0

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

已回答 4 年前
0

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.
已回答 4 年前
0

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.

已回答 4 年前
0

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.

已回答 4 年前

此貼文已關閉:已停用新增新答案、評論和投票功能。