This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
When attempting to detect collision and cause damage to entities, I think that the best approach is to use ICollisionEventsJob where I look at the types of components on each entity while doing combat and add components to destroy them in a different system later. Several questions immediately come to mind but I am not completely sure about the ICollisionEventsJob... most tutorials (very few BTW) seem to emphasize an ITriggerEventsJob but as an old-hat, this seems wrong.
Here are my questions:
- Is the
ICollisionEventsJob
best or should I just setup anIJob
and look at the CollisionEvents directly. Maybe some other job type or even a different approach altogether. - When I add a component to the ECB, can I detect that addition later? For example, does this code even work? If I add the selfDestruct component and then the bullet also happen to strike another entity (the bullets are pretty big), will I be adding a second component to that bullet?
if (selfDestruct.HasComponent(bullet) == false)
{
entityCommandBuffer.AddComponent(killer, new SelfDestructComponent {});
}
- What does a good example of a projectile affecting enemies in combat look like? I cannot find a single example online.
- Is this the proper update setup for a collision detection setup?
[UpdateAfter(typeof(ExportPhysicsWorld))]
[UpdateAfter(typeof(EndFramePhysicsSystem))]
[UpdateInGroup(typeof(PresentationSystemGroup))]
public partial class CollisionSystem : SystemBase
- Is it possible to setup multiple collision jobs in the same frame for different types? Say one for missiles, another for ships hitting one another, and maby another for explosions hitting the player?
If I want to spawn something during a collision like an explosion object, is there a good approach... some way of tracking spawning to do in another System?
I have been looking into this question for a while now (about 8 days) and there just doesn't seem to be any good answers. If you can recommend a different forum or better group of people to ask... :-)
Thanks ahead
Post Details
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/unity/comme...