Coming soon - Get a detailed view of why an account is flagged as spam!
view details

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.

1
How to Share collision data between systems in DOTS
Post Body

I have a collision system that detects when triggers on asteroids are hit and stores asteroid data, the point of collision, the player ID, etc in a NativeArray. I would like to use that data in another system to spawn "mined resources".

The collision might look like this:

public struct AsteroidHitList : IBufferElementData
{
    public LocalTransform position;
    public int playerProjectileOwnerId;
    public int resourceGeneratedTypeId;
}

public partial struct BulletTriggersOnAsteroidsSystem : ISystem
{
    NativeList<AsteroidHitList> resourcesArray;

Then I would want another system to generate resources... maybe something like this. What would be the proper way to share these data between systems:

public partial struct SpawnResourcesSystem : ISystem
{
    public void OnUpdate(ref SystemState state)
    {
        World.GetExistingSystem<BulletTriggersOnAsteroidsSystem>().resourcesArray
    }
}

Author
Account Strength
100%
Account Age
16 years
Verified Email
Yes
Verified Flair
No
Total Karma
22,639
Link Karma
530
Comment Karma
22,051
Profile updated: 1 week ago
Posts updated: 10 months ago
Engineer

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago