#archived-dots

1 messages Β· Page 57 of 1

rustic rain
#

have you used LocalToWorld or any other transforms types?

#

they have helper methods

late mural
#

but my logic needs to be used on all systems (even if that is only 2 currently...)

rustic rain
#

of all sorts

rustic rain
#

and you need to figure the other way

late mural
rustic rain
#

in manual

#

it has tons of helpers

late mural
#

i need to have dinner now, ill be back soon though, sorry, and thanks so far for everything

rustic rain
late mural
#

ok i've had dinner and i have thought really hard about this, and i think i get it now, and i think i found a better way than what i was doing previously, thanks so much for all the info, im now going to remove all those static methods, chuck the ones that are actually used (and are a replacement for more than 1 or 2 lines of code) in whatever system uses them most, should another system ever need it then i can just do it manually and not use a method at all! Hopefully that makes some sense, im tired lol, thanks so much for all the info!

devout prairie
quasi kernel
#

Hi! I'm just getting started with DOTS. I have set up an empty 2D URP project (2022.2.1f1) and it appears I'm already running into an issue. I added the Entity Graphics package (1.0.0-pre.15) to get the required dependencies. However, it appears that transport and 2D packages cause several issues which seem to be related to an old collection library, I believe:

Library\PackageCache\com.unity.2d.animation@9.0.1\Runtime\TransformAccessJob.cs(165,62): error CS1955: Non-invocable member 'NativeHashMap<int, TransformAccessJob.TransformData>.Count' cannot be used like a method.
Library\PackageCache\com.unity.transport@1.3.0\Runtime\IPCManager.cs(79,44): error CS1955: Non-invocable member 'NativeHashMap<ushort, int>.Count' cannot be used like a method.

From my short search, it appears that the NativeHashMap was renamed to NativeParallelHashMap quite some time ago.

Is this a known limitation, i.e. is 2D not supported currently or am I looking at this wrongly?
Thanks!

balmy thistle
#

What version of collections are you using? And how are you including the transport dependency?

robust scaffold
tribal pollen
#

So I'm spawning items, and realized I'm setting a new UniformScaleTransform when I spawn them and overwrite the desired scale/rotation from my prefab.
What's the normal way to handle this and only update the position?
Or do I have to get the translate component seperately from the prefab with a componentLookup?

robust scaffold
quasi kernel
# robust scaffold And yea, 2D isnt supported with DOTS in the first place

Thanks for taking the time! Oh well, that settles it then. I was thinking about prototyping a tile-based game with some interacting systems (think Rimworld or similar). Thought that could benefit from this approach. Just thought it'd be a good exercise to get my hands dirty :)... But I get that for most 2D games, this would probably be overengineered. Maybe a GO-based architecture works well enough.

rustic rain
#

and since RW barely has any animations or graphics, you don't even need neither tile map or skeleton animation to make a clone

quasi kernel
#

Yep, that's what I thought... But does "no 2D support" mean it doesn't render sprites as well? Because I suppose that'd be pretty much the only thing that's needed.

rustic rain
#

there are no 2D tools at all

#

you use 3d as 2d basically

#

with z as depth

#

and there is no 2d rendering, so under the hood it uses hybrid with GO sprite renderers

#

besides, you can use tilemap, but only in non-interactive way

#

no physics or such

quasi kernel
#

I think that'd be fine. Maybe I'll have a look. Thanks for the hints! I'm not married to the idea or anything πŸ˜„ ... I just want to avoid working against the "intended way of doing things" when I'm still learning.

robust scaffold
quasi kernel
#

So it's good to know the limitations. Maybe I missed it and it's mentioned somewhere in the docs. If not, it'd be nice to add a paragraph to the Entities Graphics documentations.

tribal pollen
robust scaffold
rustic rain
#

what's the difference, between static world regeneration once in a while vs dynamic colliders every tick?

rustic rain
robust scaffold
#

The BVH isn't rebuilt but the world state still is.

#

Static colliders only optimize skipping BVH reconstruction. There's an initial world state building that must be done every frame. Not that expensive thankfully, 1,000 colliders only result in 0.05ms parallel.

#

but that 0.05 adds up with netcode requiring 32+ physics steps for rollback.

lethal hatch
#

I'm trying to implement a nativearray/nativelist of generic structs that calculate faces for my minecraft clone.
The struct implements an interface that gives details on what exactly the mesh should look like (like vertex count, etc), so that it is easier to add new or different shapes other than quads like spikes or flowers in the future. however it seems that unity jobs doesnt like me doing this as it wants me to use a non-nullable value type. is there a good alternative or workaround to this?

#

ideally, I should be able to have one nativearray or list for a whole grid of differently shaped faces

#

i suppose i could just store an int or enum which tells the mesh generator what type of mesh it is maybe? but that also makes it harder if I need to do any precalculations to a type of shape before it is sent in to be generated

robust scaffold
robust scaffold
lethal hatch
robust scaffold
misty wedge
#

unionizing the values for faster netcode serialization is sneaky

#

Although couldn't you just make it a long at that point? I've never checked how netcode actually serializes everything

robust scaffold
#

But yea, a ulong would work as well... hrm

misty wedge
#

I thought netcode only serializes the entire component and checks the hashes to check for changes?

#

Or is it per field

robust scaffold
#

Which I assume wastes a lot of bits. Depending on how the bitpacking works. Probably doesnt do anything honestly

misty wedge
#

I just thought it would be (very slightly) faster to serialize a single long than 2 uint, but it probably makes no difference

#

(and like I mentioned I never actually checked how it does it so I might be completely wrong)

robust scaffold
#

same here

misty wedge
#

Yeah pretty much, no idea if it's faster or slower though πŸ˜…

safe lintel
#

anyone ever had the Allow unsafe code setting not work? annoying, ive deleted the library but it still thinks its not ticked

rustic rain
safe lintel
#

yeah

rustic rain
#

then I guess just try to restart

robust scaffold
safe lintel
#

ah wait it was cos it was in the package not the general project.

#

yeah that was it πŸ™‚

#

painful to delete library on an older surface pro

robust scaffold
#

Ah, how do you resolve player-player collisions then?

rotund token
#

Why doesn't it just work?

#

From the players perspective how is the collision different to any other interpolated ghost

robust scaffold
#

Because on the client, interpolated objects are enforced kinematic, so predicted objects will bounce off them like walls. But on the server, everything is dynamic since there is no such thing as interpolated serverside physics. So objects collide and push normally.

rotund token
#

That's kind of the nature of prediction

robust scaffold
#

I've made everything predicted which solved the issue of collisions but remote player controlled objects move very poorly.

rotund token
#

Your player is not a kinematic?

robust scaffold
#

No? It's a dynamic object

rotund token
#

Most controllers still use kinematics and execute the dynamics itself

robust scaffold
#

I would really hate to implement a full 3D physics stack just to move a single player.

#

Because, from what I can tell, kinematics dont interact with static objects.

rotund token
#

Controllers often have a dedicated developer or even small team working on it for the entire game development

#

It's a lot of work

robust scaffold
#

ugh

rotund token
#

Sounds like you should use rival πŸ˜„

robust scaffold
#

im looking at it now, im gonna see if i can clamp it to 2d without any particular hacks

rotund token
#

alternatively check out the netcode car demo from unity

#

since those cars are heavily physics based objects

#

actually yeah they use dynamic physic object cars on owner predicted

#

so that seems like a good source of an example of what you wanted to do originally

devout prairie
#

Fwiw, this is the crash i've been getting since switching to 2022.2.1f1 and dots 1.0

robust scaffold
rotund token
#

hmm worked fine for me

#

what was issue?

robust scaffold
#

Give me a sec, pulling up the repo

rotund token
#

oh i never tried multiplayer

#

i would have hoped so

#

because that'd be the whole fun of the demo

rotund token
#

allocating 1TB of memory will do that

devout prairie
# robust scaffold out of memory?

yeah.. basically it seems fine when i'm actively working on the project - when i walk away from the pc for any length of time i come back to that

#

seems like probably a memory leak

rotund token
#

hmm not sure

#

we had a similar bug a few years ago

#

just randomly try allocate like 40GB of memory

#

was basically just a bad write on a pointer

devout prairie
#

hmm

rotund token
#

not saying this is you

devout prairie
#

my only real suspect is baking tbh

rotund token
#

graphics has the most issues of the packages for me atm

devout prairie
#

or potentially one of the assets ( i use a fog asset that does graphics related stuff obviously )

robust scaffold
#

Failed to load 'C:/Users/CornFlakes/Documents/ECS-Network-Racing-Sample-master/Assets/Terrain/Terrain_0_0_89adce58-f5ec-4f5a-803b-a54fad3b41f3.asset'. File may be corrupted or was serialized with a newer version of Unity. That's error when I try to play the car sample. And I'm on 2022.2.1F1

devout prairie
#

i haven't really tried to get to the bottom of it yet tbh, i'll maybe try removing that asset from the scene etc.

devout prairie
rotund token
#

yeah physics baking (unless there was something else I missed as well)

#

but that looks like just a terrain asset?

robust scaffold
#

Yea, just a broken asset I think

rotund token
#

but yeah no issue

#

just loaded it up then

robust scaffold
#

Hrm, it's 1kb size. I think something just overwrote it. Gonna grab a copy from github

rotund token
#

ah did you pull/clone the repo or just download it rom github?

#

you have to pull with LFS

robust scaffold
#

Yea, just realized that. Doing that now

#

huh, I thought they fixed this physics baking problem?

rotund token
#

look at this post

#

this poor guy, reported it like 2 weeks ago

#

"update editor, reimport" etc etc

#

i load up racing sample, get it first thing, report it

#

they can repo it instantly

#

but i don't understand, how whoever was developing the racing demo didn't report it -_-

#

it reminds me of my work, people see a red error, 'clear' - "Someone else must have reported it already"

robust scaffold
rotund token
#

anyway i loaded up rival, it does not seem to use dynamic controllers (seem to be static) which is what I suspected

robust scaffold
#

I thought the backport fix already came through because I can use physics smoothing on my main project with no issue.

#

ugh, i have to go through all the prefabs to try and find physics bodies with interpolation on just to fix this error

#

There we go

#

hrm, doesnt look thin clients work

#

Yea, collisions are really bad in this

robust scaffold
#

Wow, so many shaders

misty wedge
#

Is Unsafe.NullRef burst compatible?

rotund token
#

i don't even know what that is

misty wedge
#

It returns ref that is "equal" to null

#

And you can use Unsafe.IsNullRef to check

rotund token
#

from what library

misty wedge
#

Unsafe

#

it's part of C#

#

Runtime.CompilerServices

#

But it's not part of what unity uses

#

I think you can build something similar with the methods in UnsafeUtility though

rotund token
#

it seems internal

misty wedge
rotund token
#

to the c# library?

#

    [NonVersionable]
    [MethodImpl((MethodImplOptions) 256)]
    public static bool IsNullRef<T>(ref T source) => ref source == IntPtr.Zero;```
#

hmm

#

what am i missing

misty wedge
#

Weird

rotund token
#

wait

#

that seems to be in .net 7

misty wedge
rotund token
#

oh wait no, .net 5+

misty wedge
#

In a "normal" C# project it's not internal

rotund token
#

regardless i guess question is

#

why do you need it? but an null check is fine in burst

#

(but yeah, i thought unity didn't support .net 5 yet so I'm not sure how you're using it πŸ€·β€β™‚οΈ)

#

(or am I mixing up all the confusing versions again)

misty wedge
#

I'm trying to write a TryGetValue that returns by ref

#

I'm using a BlobHashMap library someone wrote and their methods don't return by ref, which is an issue for me

#

What happens if you do ref (*(T*) ptr) where ptr == null?

#

I'm guessing it's a bad idea to use the value, but in theory getting the address of it should also resolve to null, right?

drowsy pagoda
#

Is there a built-in way to disable an entity? (like collider and mesh) in 1.0?

rotund token
misty wedge
#

It didn't work before?

rotund token
#

unity broke it in 0.16 from an unneeded safety check

misty wedge
#

Ah yeah, I removed that

#

πŸ˜…

#

(who needs safety amirite)

#

The blob safety system is so weird, it just doesn't seem to catch a lot of stuff

rotund token
misty wedge
#

Does getting the address of the ref resolve back to null though?

rotund token
#

only 1 way to find out

misty wedge
#

Seems to work

#

returns true πŸ€·β€β™€οΈ

#

Using the value even throws a nice NullReferenceException, so also seems pretty "safe" to use

late mural
#

if only 1 entity has a specific component does it automatically get treated like a singleton component, or do i need to specifically mark it somehow?

rotund token
#

automatic

#

a singleton in entities is simply a unique (set of) component(s)

late mural
#

ok cool, thanks a ton!

tribal pollen
#

How is dots performance on mobile?

void girder
#

Is there a way of updating shared components without forcing a sync point or using an ecb?

misty wedge
#

By definition they need a sync point for their value to be changed

void girder
#

I thought that since they can be unmanaged now that restriction would no longer exist

coarse turtle
#

for a MultiValuedHashMap, is a value enumerator deterministic/consistent? πŸ€”
E.g - if I store multiple values for a key and grab a value enumerator, will iterating along the value enumerator have the same order between multiple runs? Or should I not bet on this and actually store a 'sort key' so I can iterate things in the order that they're stored into the MutliValuedHashMap?

misty wedge
#

Normally I think the order for set type containers is undefined

balmy thistle
#

They require a sync point because changing a shared component value potentially repartitions entities and changes chunk layout

coarse turtle
misty wedge
#

The reason they require a sync point isn't because they weren't unmanaged before though

void girder
misty wedge
#

That doesn't just risk a structural change, it is one

void girder
#

Does it force data to be moved?

misty wedge
#

If the SCD value is changed, yes

void girder
#

Even if all of the entities sharing that scd has it changed all together? Ideally no extra work would be done

misty wedge
#

I don't think this is checked for, I might be wrong though

#

Pretty sure it's always a structural change

void girder
#

Yeah probably honestly

misty wedge
#

The idea is to just not change them that often

devout prairie
#

Been getting this wonderful error..

#

When i hit play with the subscene open it's fine

misty wedge
#

Everyone gets that error pensive

devout prairie
#

Well it doesn't load the subscene in playmode when the subscene is closed

#

and it wasn't previously throwing this error 😐

misty wedge
#

It just breaks sometimes

#

The "quickest" way to "fix" it is recompile, then clear the entity cache

#

But it will break again at random times

devout prairie
#

yeah i couldn't find the clear entities cache option in 2022/ecs 1.0

misty wedge
devout prairie
#

ah yeah thanks

rotund token
#

Agents = SystemAPI.GetSingletonBuffer<NavMeshAgents>(true),
you request a nice little buffer readonly

#

but unity don't care, have write access anyway

misty wedge
#

tertle help, my function works with burst off and breaks with burst on 😬

rotund token
#

kekw

misty wedge
#

What even is this error message

#

System.IndexOutOfRangeException: Index {0} is out of range Length {1}

#

I guess the formatting broke

#

And it's not actually 0 and 1

rotund token
rotund token
misty wedge
#

Great then how do I debug this pensive

devout prairie
rotund token
#

so that's just the format string

misty wedge
#

Time to print random stuff everywhere

rotund token
devout prairie
rotund token
#

!

misty wedge
#

I thought you can't in burst functions?

rotund token
#

2022.2 and burst 1.8 supports break pointing

misty wedge
#

waht

rotund token
#

(by simply turning burst off automatically where you put a break point)

#

but yeah there is little reason to turn off burst

rotund token
misty wedge
#

Does that not work with burst?

rotund token
#

is it erroring?

misty wedge
#

Yeah

#

(I'm talking about the "Break on user exceptions" setting in rider)

rotund token
#

oh that doesn't do anything

#

you need to set a break point

misty wedge
#

If I set the break point where the exception is thrown, it doesn't get thrown anymore, I'm guessing because it turns off burst

#

great

rotund token
#

yeah

#

before you go crazy

#

have you tried clearing your burst cache

misty wedge
#

How do I do that?

rotund token
#

close unity

#

delete library/burstcache

#

restart unity

misty wedge
#

I thought the caching issues were fixed?

#

I'm on 1.8.2

rotund token
#

no

#

there is definitely an issue with burst caches i keep running into

#

(basically a crash or quitting unity while compiling just breaks everything for me atm)

misty wedge
#

Still throws the error :[

#

I'll just add my own checks and debug that way

coarse turtle
misty wedge
#

@rotund token I don't think ref pointers resolve back to null in burst

#

The highlighted line is where a NullReferenceException is being thrown

#

Kind of a bummer

#

Yeah, this doesn't log anything

#

It works outside of burst

#

Would be nice to add that to the burst docs, since it seems to be missing. Kind of a niche thing anyways

rotund token
#

does this just not mean your IsNullRef line doesn't work

#

because it's returned the null ref pointer fine

misty wedge
#

πŸ€·β€β™€οΈ

rotund token
#

i think I used it something like
ref value TryGetValue(T key, out bool found)

#

or something

misty wedge
#

That doesn't work if that functions calls a function that also needs to return by ref

#

Which can be worked around, but it's still really annoying

rotund token
#

what do you mean?

#

it just changes your code to

ref var result = ref data TryGetFirstValue(key, out var isValid);
if (!isValid)
{
    value = default;
    return false;
}

value = result;
return true;```
misty wedge
#

if TryGetFirstValue uses a function that returns by ref, you will get a compile error

#

You can't have a function return by ref and have a ref or out parameter

rotund token
#

oh i see what you're saying

misty wedge
#

(and then call another function with the same properties)

#

It's not a huge issue, since I can just put everything in one function, but it's still kind of annoying

rotund token
#

wait it seems to work fine for me?

misty wedge
#

Let me check, I had issues with that when refactoring earlier

rotund token
#
            where T : unmanaged
        {
            result = true;

            return ref UnsafeUtility.ArrayElementAsRef<T>(array.GetUnsafePtr(), index);
        }```
#

this compiles fine

#

(at least in rider)

misty wedge
#

This gives a better explanation of why it's not allowed

rotund token
#

that's because of this line here

#

comment that out, set hasKey = true

misty wedge
rotund token
#

thats a completely different error

misty wedge
#

What

#

It's the same one

misty wedge
rotund token
#

these are not the same error

#

out _
is 'it'

misty wedge
#

I assume it doesn't show the actual issue, instead only telling you that it's not a valid thing to return by ref

#

That's why the error message is different

rotund token
#
            where T : unmanaged
        {
            ref var a = ref UnsafeUtility.ArrayElementAsRef<T>(array.GetUnsafePtr(), index);
            result = true;
            return ref a;
        }```
this works fine for me
#

i don't know what is up with your iterator

#

but just make a method that doesn't return it?

misty wedge
#

Yes, because you aren't calling a function with an out value in that function

#

If ArrayElementAsRef had a ref or out parameter, that wouldn't work

#

both parameters are passed by value

#

Alternatively call ElementAt in a function that also returns by ref

rotund token
#

i think you're overlooking a really easy solution

#

get rid of the out

#

you aren't using

#

make an overload without it

misty wedge
#

Returning null ref is still kind of awkward though since afaik you can't force a function to "receive" the return value as a ref

#

Overwriting a local value with the null ref value immediately throws a NullReferenceException

rotund token
#

you know it's weird

#

it's not a compiler error for me

#

just a warning

misty wedge
rotund token
misty wedge
#

???

rotund token
#

???

misty wedge
rotund token
#

warning not an error

misty wedge
#

That's really odd

#

hacker

#

I'm calling the police

#

It's definitely a compile error for me

rotund token
#

it was a compile error when i did it a different layout

#

like this

#

anyway i don't care about, too weird just use pointers πŸ˜„

misty wedge
#

Yeah I thought about it, but It feels weird to use pointers for one thing in blobs, and ref for everything else

#

πŸ€·β€β™€οΈ

cunning perch
#

someone call the ref police

misty wedge
#

I think I'm going insane

#

waht

#

is going on

robust scaffold
#

The double ref might be a problem.

misty wedge
#

I'm starting to think so too

#

Maybe burst can't pass a null reference or something

#

(as ref)

#

But then I don't see why AddressOf works

robust scaffold
#

If you pass a null reference as a ref property, it may be resolving the wrapper variable which is valid but the reference itself is null.

misty wedge
#

But then AddressOf would also not work

#

Is there an easy way to print the memory address of a pointer from inside of burst?

#

I only know the IntPtr string formatter, but that won't work in burst

#

It has to be pointing to something for it not to evaluate to null

rotund token
#

just do addressof and then get the address of the pointer, cast it to an int

#

and write it out

#

x4 if you want to format as hex

misty wedge
#

It's 0

rotund token
#

as expected

misty wedge
#

Yeah, odd that the null check doesn't work

rotund token
#

just compare it to IntPtr.Zero

#
            return new IntPtr(p) == IntPtr.Zero;```
something like that?
misty wedge
#

Somehow that still doesn't work

#

I give up

#

I'm gonna say it's because its 3:51 am

misty wedge
#

Time to sleep πŸ›οΈ

rotund token
#

you're copying it locally maybe?

misty wedge
#

How? It's passed by ref

rotund token
#

oh wait no

misty wedge
rotund token
#

thought it was a different method

misty wedge
#

Funnily enough it works if I cast the pointer to an int and compare to 0

#

πŸ€·β€β™€οΈ

calm edge
#

I think burst assumes references can't be null and optimises some code out

#

I've had problems with that in the past

#

safer to use pointers if it can be null

#

Is there any way to get entities to render in the scene view?

rotund token
#

they should by default

#

if they aren't, check your authoring settings

#

is set to runtime data

calm edge
#

That was it, ta

late mural
#

probably a silly question, but how do i remove a component from an entity?

robust scaffold
late mural
safe lintel
#

anyone know how ScheduleParallelByRef compares to ScheduleParallel? i see it used in the LocalToWorldSystem

robust scaffold
safe lintel
#

hmm, I guess ill use it then? any downsides if you dont have lots of same structs? is there any doc or forum post on it?

robust scaffold
rotund token
#

for caching temp allocation etc

#

i generally find it, not worth the rare error

late mural
#

just checking that this is a good way to get read write for a component on a known entity? ```cs
state.GetComponentLookup<SomeComponent>().GetRefRW(SomeEntity, false);

late mural
late mural
rustic rain
#

oh yeah

#

that's a wrong one then

#

kek

#

well you can just do

#

GetComponent

#

and then SetComponent in the end

late mural
#

ooh good point, thanks for the info!

rustic rain
#

As alternative

        /// <summary>
        /// Provides an unsafe ref to component data directly. Gets invalidated on any structural change.
        /// </summary>
        /// <param name="em"></param>
        /// <param name="entity"></param>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        [GenerateTestsForBurstCompatibility]
        public static unsafe ref T GetComponentReference<T>(this EntityManager em, in Entity entity)
            where T : struct, IComponentData
        {
            var access = em.GetCheckedEntityDataAccess();
            var typeIndex = TypeManager.GetTypeIndex<T>();

            access->EntityComponentStore->AssertEntityHasComponent(entity, typeIndex);
            access->EntityComponentStore->AssertNotZeroSizedComponent(typeIndex);
            if (!access->IsInExclusiveTransaction)
                access->DependencyManager->CompleteWriteDependency(typeIndex);

            // var ptr = access->EntityComponentStore->GetComponentDataRawRW(entity, typeIndex);
            var ptr = access->EntityComponentStore->GetComponentDataWithTypeRW(entity,
                typeIndex,
                em.GlobalSystemVersion);

            return ref UnsafeUtility.AsRef<T>(ptr);
        }
#

but generally it's better to use SystemAPI

#

the code I sent is only good if you only have just 1 component of T type to look up for RW in OnUpdate cycle

late mural
#

ok fascinating, thanks for the info

late mural
#

wondering how would i set the name of an entity? (if entities even have names)

rotund token
#

EntityManager.SetName

late mural
devout prairie
#

any idea if any of the physics devs spoke during the Q&A?

safe lintel
drowsy pagoda
#

Does anyone know how to add leaf colliders to a compound collider at runtime?

rustic rain
#

oh wait

#

compound...

#

yeah... nvm me

drowsy pagoda
#

Heck I'll even take how to make a compound collider from scratch during runtime at this point.

rustic rain
#

sounds like overcomplicating things

drowsy pagoda
#

I have items that can be attached to each other, like assembling something like a chair or a computer, etc. So you can detach a part, and then eventually have compatible parts that can be attached to different assemblies.

rustic rain
drowsy pagoda
#

I did. And i got it to work perfectly.

#

But the issue was when an item falls to the ground that has fixed joints, it then jumps up wildly.

#

I tried everything, wrote a bunch of questions in this room. And no results.

rustic rain
#

πŸ€”

drowsy pagoda
#

Now I'm back to combining colliders 😦

rustic rain
#

Ragdolls in sample don't jump wildly

drowsy pagoda
#

But I don't need ragdolls, I need just simple, fixed joints. Basically to replace the traditional Transform Parent Child system.

rustic rain
#

ragdolls are pretty much joints

drowsy pagoda
#

Pretty much.

rustic rain
#

I don't remember them having anything

#

have you tried to reproduce your bug in isolated environment?

drowsy pagoda
#

Yes, it's actually where the bug occured. I have an environment just for building this behavior.

rustic rain
#

you could report to unity

safe lintel
#

i think if a fixed joint is causing a physics thing to jump around wildly it should be considered a bug, but im not really sure on behaviour of stuff like how collider penetration when fixing two rigidbodies together should be expected with this

rustic rain
#

btw

#

do your joints have very fixed angle

#

or some slight movement is allowed?

#

maybe that could help?

drowsy pagoda
#

Oh yeah I tried that too, allowing some degree of movement, but that gave me other unwanted behavior.

rustic rain
#

oh btw

#

did you check

#

PhysicsStep component?

drowsy pagoda
#

Yup, cranked that shit up to extremly high step counts.

#

Tried all sorts of variations.

#

Didn't help one bit

#

Been working on this at every angle I could think of for a week straight lol.

#

Bout ready to give up on this project.

rustic rain
#

send it to Unity?

drowsy pagoda
#

That I haven't done.

devout prairie
# drowsy pagoda Tried all sorts of variations.

Could it be something to do with the mass or inertia of your objects prior to attaching with fixed joint? Have you tried creating an equivalent gameobject setup in a subscene with fixed joint and seeing how it behaves?

drowsy pagoda
#

Inertia I haven’t considered. What’s the rule about inertia?

devout prairie
#

Well I think if your objects are misbehaving maybe probe some of the physics values and compare against for example a simple baked version of your body object

#

Just wondering if you are for example disconnecting an object that is part of a compound hierarchy for example and then adding physics mass etc to it when creating the jointed setup at runtime ( assuming that's what you're doing? ) maybe they are not initialized properly or something along those lines

drowsy pagoda
#

In authoring, all items are separate. You assemble them at runtime. I never pluck off a child/leaf collider from the body.

#

The joints are created during bake for items that will have other item(s) attached to them. Then during gameplay, I just assign the other body to the joint data.

rotund token
#

Did you try with havoc out of interest or no access to licence?

drowsy pagoda
#

No access to license. I want to though 😦

robust scaffold
viral sonnet
#

isn't stability the main appeal of havok?

robust scaffold
#

I guess, yea. That's what they're advertising.

covert lagoon
#

Is the performance about the same?

devout prairie
# covert lagoon Is the performance about the same?

one of the benefits is because Havok is stateful bodies can 'sleep' meaning if they are within a threshold of movement they'll no longer be factored in to simulation calculations, so sims with large numbers of objects will benefit from that where a lot of dynamic objects are stationary..

#

i think though because Havok is stateful it can also have a little bit more overhead so in some cases be slightly less performant..

covert lagoon
#

Hm.

devout prairie
#

kinda tricky to debug this one

hushed lichen
#

well, need to track down that q I guess πŸ™‚

calm edge
#

Make sure stack traces are enabled for asserts in the player settings

calm edge
#

Is there something I need to do to get a subobject in a subscene to update it's position relative to it's parent?

robust scaffold
calm edge
#

it seems it's not set up properly for the built in parenting

rotund token
#

is the child a physics object?

calm edge
#

the child isn't, but the parent does have physics

rotund token
#

children should just work

calm edge
#

there is no PropagateLocalToWorld which seems like it might be necessary?

#

in the editor I can see LocalToWorld changing, but not WorldTransform

rotund token
#

WorldTransform should be set to LocalTransform every transform update

#

are you using rival by any chance?

calm edge
#

I am

rotund token
#

yeah we ( @minor sapphire & I) noticed a bug with rival

#

rival overrides the transform system with a write group but doesn't update the WorldTransform

#

so your character is always at 0,0,0

#

you need a system after rivals own transform system that writes WorldTransfrom = LocalTransform

calm edge
#

hmm, are they cheating for the camera controller then?

#

cause that works

rotund token
#

i dont use rival

calm edge
#

LocalToWorld targetLocalToWorld = SystemAPI.GetComponent<LocalToWorld>(mainEntityCameraEntity);
hmmm

rotund token
#

i am summoning shinyclef with his fix

minor sapphire
#

oh hi

#

hold on I'll paste a system for you πŸ˜„

#
    /// <summary>
    /// Rival has a WriteGroup on component <see cref="Rival.CharacterInterpolation"/> that prevents the
    /// TransformSystem from updating the WorldTransform. This system copies LocalTransform to WorldTransform
    /// for any root objects with the CharacterInterpolation component.
    /// </summary>
    [UpdateInGroup(typeof(TransformSystemGroup))]
    [UpdateBefore(typeof(LocalToWorldSystem))]
    [UpdateAfter(typeof(CharacterInterpolationSystem))]
    [WorldSystemFilter(WorldSystemFilterFlags.LocalSimulation | WorldSystemFilterFlags.ClientSimulation)]
    [BurstCompile]
    public partial struct CharacterInterpolationWorldTransformFixSystem : ISystem
    {
        public void OnCreate(ref SystemState state) { }

        public void OnDestroy(ref SystemState state) { }

        [BurstCompile]
        public void OnUpdate(ref SystemState state)
        {
            new CopyTransformJob().Schedule();
        }

        [BurstCompile]
        [WithAll(typeof(CharacterInterpolation))]
        [WithNone(typeof(Parent))]
        private partial struct CopyTransformJob : IJobEntity
        {
            private void Execute(ref WorldTransform worldTransform, in LocalTransform localTransform)
            {
                worldTransform = (WorldTransform)localTransform;
            }
        }
    }
calm edge
#

thanks, I just hacked up the CharacterInterpolationJob instead of adding a new system πŸ˜›

#

I'll have a read through that thread later

signal phoenix
#

Huh, i should make sure the WorldTransform gets properly updated next time I update the package. I was too used to always using LocalTransform for rigidbodies so I never noticed it.

@minor sapphire I'll be answering your forum questions probably tomorrow

minor sapphire
#

porting first person sample to a third person context probably leaves some gaps somewhere heh

calm edge
#

The other problem with rivals I had was having 100s of physics objects causes the rivals code to take a massive amount of time doing physics steps

#

I'm new to ECS physics, but It seems like it's manually stepping the entire physics world?

#

oooh, I get it now, it's not the rivals code, it's the normal physics step that happens before and then the rivals code is waiting for its job to complete

rotund token
#

this is just a fixed step death spiral

#

not having burst on doesn't help

calm edge
#

Yeah, but I was just confused at what was responsible

#

I was just seeing how far I could push it

late mural
#

this warning appeared in the ide im using (visual studio), is it anything to be concerned about, or should i just ignore it?

rotund token
#

interesting error but i wouldn't be too concerned if it's not popping up in unity

late mural
#

ok good!

safe lintel
rotund token
#

hmm i'm not sure that's too surprising?

#

it has to do a lot more to determine state/sleeping/etc

#

but generally I think you'd have a lot sleeping so in most real world scenarios it's probably going to run a bit better

#

i tried to add the concept of coming to rest in unity physics, my implementation ended up being so gross

#

i need to figure out a good way to do it, determining rest was a pain

late mural
#

is it possible to use EntityManager.SetName() in a bursted function or is it impossible?

rotund token
#

it wasn't before, probably still not

late mural
#

ah unfortunate

late mural
#

EntityManager.CreateEntity(); will always put the new entity at 0 0 0 right? Meaning any child entities should have their local position be equal to their world position?

safe lintel
#

makes sense but at the same time i thought for sure havok would be super duper optimized or whatever to ensure it was the fastest and best choice of the two

rotund token
#

on the other hand, unity physics built specifically for burst

#

i haven't really benchmarked or seen a real world test so if anyone has one would be interesting to look at

safe lintel
#

i do wish they had gone forward with the extra low fidelity 3/6dof rigidbodies like they alluded to a while ago

#

not sure what the plan for stuff is long term but for many of my own uses just something that bounces/collides but doesnt need a super accurate sim would be fantastic for effects

gusty comet
#

I'm having an issue where I verify completely that I added elements to a DynamicBuffer inside of a Baker, and that during Baking the elements exist in the DynamicBuffer, and that DynamicBuffer is NEVER cleared or has its elements removed elsewhere in the code. Yet, the moment the game is run, the DynamicBuffer is shown as empty. What could be the reason for this?

#

This is only happening to one of my DynamicBuffers. Everything else works. the chunk size is far from being exceeded by a single entity

#

The Entities Hierarchy is showing that the elements exist

#

Both in Edit Mode and Play Mode

#

I'm printing the length of that DynamicBuffer inside of a job and it's always 0. That's despite the Entities Hierarchy showing that the DynamicBuffer has 2 elements

#

It's not disabled either

rotund token
#

your code has the funk!

#

not doing a reinterpret or something on the buffer

#

so the clear isn't being found from inspection?

#

ooo

#

ECB.AddBuffer?

#

try use the journal - it should tell you everywhere your component is accessed

gusty comet
#

Thanks for the suggestions. No reinterpret. I searched for usages and they're all confined to one file, which I scoured thoroughly. No .Clear(), no Remove(), no ECB.AddBuffer(). The journal didn't reveal anything - printing the length of the buffer from within a job shows 0 despite Entities Hierarchy literally showing the 2 elements it's supposed to have. Here's the access code:

foreach (var eventDone in eventDones.AsNativeArray())
                {
                    EventActionsJob.Execute(ECB, eventDone.Entity);
                }
#

It's inside an IJobEntity with this

rotund token
#

what is DecisionMakerEventDoneElement

#

and what does your baker look like

late mural
#

what would be the best way to get an array of all components of a certain type, guessing using an entity query then using ToComponentArray<>()?

late mural
rustic rain
#

It will copy all data on new memory

late mural
#

ah, should i use a get RW version then?

rustic rain
#

Yoo shoulg use job

#

that accesses compenets

late mural
#

ok and how would i access the components in a job?

rustic rain
#

i job entity

#

Or i job chunk

late mural
#

ok thanks a ton!

rustic rain
#

Non job alternative - systemapi query

late mural
#

ok

lethal cairn
#

Is it required entities to be in a subscene so that systems can operate on them?

#

I have entities existing outside of a subscene and observe that the movement systems won't move them, even though the systems can query them.

late mural
#

trying to use an IJobEntity, how do i complete the job?

rotund token
#

from the perspective of a query there is no difference between an entity in a subscene and not

late mural
hushed lichen
#

Are you using an EntityCommandBuffer?

rustic rain
#

they have examples of IJE implementation

late mural
#

ah i see, im an idiot, thanks a ton!

lethal cairn
hushed lichen
lethal cairn
#

Am I doing it wrong here?

#

It knows there are 10 entities matching the query

#

But it doesn't run

hushed lichen
#

Huh, I have no idea

rotund token
#

did you throw in a debug log?

#

or a break point?

rustic rain
#

What singleton do I need to get

#

to run TriggerEventsJob?

#

SystemAPI.GetSingleton<SimulationSingleton>(?

rotund token
#

yes

rustic rain
#

after what systems those jobs are played back?

smoky otter
#

Hello, I am using Unity 2021.1.2, I am trying to implement something in the JobSystem, I have all the packages needed and can use NativeArrays, but I cant seem to find "NativeList", anyone familiar with this problem?

rustic rain
#

oh btw, what was that the fastest way to check whether entity matches query (has component)?
Smth about query mask if I remember

rotund token
#

yeah entity query mask

rustic rain
#

so, I just pass it to job and that's it?

rotund token
#

yep

#

create it from a query with .GetEntityQueryMask()

rustic rain
smoky otter
rustic rain
rotund token
#

it should work fine for disabled component

#

queries can match disabled entities

#

if you tell it to

rustic rain
#

I'm trying to figure what's better:

  1. using IEnablableComponent
  2. using buffer that contains list of disabled entities

Since application has very little entities (like probably 5 max disabled entities to track, before they are cleared)

rotund token
#

yes by default queries ignore disabled components

#

but you can tell them to include them

rustic rain
#

and ignore filter says

#

no I mean, this is mask

rotund token
#

yes but masks are made from queries no?

#

all entities in a query should return true if passed to the mask

#

so if my query is returning disabled entities, the mask should match them

rustic rain
#

it says it won't

#

look at last screenshot

rotund token
#
        protected override void OnCreate()
        {
            var query = new EntityQueryBuilder(Allocator.Temp)
                .WithAll<TestComponent>()
                .WithOptions(EntityQueryOptions.IncludeDisabledEntities)
                .Build(this)
                .GetEntityQueryMask();

            var entity = this.EntityManager.CreateEntity(typeof(TestComponent));
            this.EntityManager.AddComponent<Disabled>(entity);

            Debug.Log($"Matches Query {query.MatchesIgnoreFilter(entity)}");
        }
#

why do you make me do this!

rustic rain
#

but Unity description literally says so

#

lol

#

oh, btw

#

YOu specifically included disabled

#

meanwhile it should be vice versa

rotund token
#

what?

rustic rain
#

.WithOptions(EntityQueryOptions.IncludeDisabledEntities)
For my case I don't want this option

rotund token
#

then don't use it?

rustic rain
#

as I want to filter disabled somehow

rotund token
#
            var query = new EntityQueryBuilder(Allocator.Temp)
                .WithAll<TestComponent>()
                .Build(this)
                .GetEntityQueryMask();

            var entity = this.EntityManager.CreateEntity(typeof(TestComponent));
            this.EntityManager.AddComponent<Disabled>(entity);
            Debug.Log($"Matches Query {query.MatchesIgnoreFilter(entity)}");```
rustic rain
#

πŸ€”

#

Did you test it with EnablableComponents?

rotund token
#

no

rustic rain
#

then I guess this is where mask won't work

rotund token
#

yes because it doesn't support filtering as the method says

rustic rain
#

well, my question initially was about them πŸ˜…

#

but I appreciate you showed interaction with query options

rotund token
#

Disabled

#

is a component

rustic rain
#

I guess under the hood Query automatically add Disabled Prefab and etc options

#

yeah

rotund token
#

which it does work for!

#

the question you are asking does it work for IEnableableComponent

rustic rain
#

yeah, and it's not. So I'm considering either using query check

#

or making buffer

#

which will contain disabled entities

rotund token
#

fastest way is to probably just do a IsEnabled on ComponentLookup

#

if you care about a specific state

rustic rain
#

in one case I'll have to implement IEnablableComponent pipeline
in other I'll have to implement a singleton buffer

I'm figuring which is less evil πŸ˜…

rotund token
#

i assume this is an entity reference?

rustic rain
#

my use case:
if player collided with specific trigger, trigger should get disabled.
Meanwhile trigger should only get disabled, no entity itself.

#

buffer for such disabled triggers will be very small, max 5 if player is lucky

rotund token
#

that seems straight forward enough

#

what's the problem?

#

should the trigger stay perm disabled (i.e. removed from physics simulation?)

rustic rain
#

I guess I'll just make IEnablableComponent

#

it's time for me to learn how they work at least

#

πŸ˜…

rustic rain
#

Hmmmm.

        [BurstCompile]
        public void OnUpdate(ref SystemState state)
        {
            var singleton = SystemAPI.GetSingleton<EndFixedStepSimulationEntityCommandBufferSystem.Singleton>();
            var buffer = singleton.CreateCommandBuffer(state.WorldUnmanaged);

            state.Dependency = new InteractionJob
            {
                ecb = buffer,
                buffer = SystemAPI.GetBuffer<InteractionBuffer>(_interactionBuffer),
                interactableMask = _interactableMask
            }.Schedule(SystemAPI.GetSingleton<SimulationSingleton>(), state.Dependency);


            buffer.SetBuffer<InteractionBuffer>(_interactionBuffer);
        }
#
InvalidOperationException: The previously scheduled job InteractionSystem:InteractionJob writes to the Unity.Entities.EntityCommandBuffer InteractionJob.UserJobData.ecb. You must call JobHandle.Complete() on the job InteractionSystem:InteractionJob, before you can write to the Unity.Entities.EntityCommandBuffer safely.
#

did I do smth wrong?

rotund token
#

buffer.SetBuffer<InteractionBuffer>(_interactionBuffer);

#

you passed the buffer to the job then used the same buffer on the main thread

rustic rain
#

I see

#

safety system triggered because job handle was not complete

#

during that write

rotund token
#

just do it before the job and it should be fine

rustic rain
#

yeah, I just wanted to know why exactly it was a problem

#

hmm

#

So I need to make a physics object that can move and has physics object children.
It only gets moved by transform, no physics involved.
It's basically just moving trigger

#

and I need it to have multiple trigger shapes, which will produce different effect on trigger event

#

I used to do it previously with static colliders

#

it worked back in 0.51, but not anymore

#

so I'm wondering if I should make some sort of custom parent system, that will move children accordingly or...

#

damn

rotund token
#

Compound trigger should work right?

rustic rain
#

does compound allow you to distinguish between collider/entity pair?

#

for example:
on top you have sphere, on bottom box.
If sphere is triggered - result is A.
If box is triggered - result is B.

rotund token
#

I believe the collision events have the compound collider key included

#

So you can find the specific collider that hit

#

I'm in bed so can't look it up

rustic rain
#

yeah, trigger events has this property

#

I do wonder though, how can I get original entity from this collider key

#

I guess I will need to make some sort of dictionary on main entity during baking?

rotund token
#

From memory you get rigidbody which has the entity

rustic rain
#

meanwhile collider key is just uint

rotund token
#

Yeah it references a dynamic buffer on the entity with an the children I think?

#

Been a long time since I looked at this though

rustic rain
#

πŸ€”

rotund token
#

Physics and I are not on good terms atm (well to be fair, more netcode handling of physics)

rustic rain
#

to setup compound

#

what do I need to change on shapes/bodies?

#

or do I even need body on children?

rustic rain
#

looks like main entity has this buffer

#

all right

#

so maybe this works

rustic rain
#

bruh, smth wrong with my algorithm and Editor crashes if I try to debug it

#
                if (colliderKeyLookup.TryGetBuffer(e, out var buf))
                {
                    var triggeredEntity = GetTriggeredEntity(buf, key);
            private static Entity GetTriggeredEntity(DynamicBuffer<PhysicsColliderKeyEntityPair> dict, ColliderKey key)
            {
                foreach (var keyEntityPair in dict)
                {
                    if (keyEntityPair.Key == key)
                    {
                        return keyEntityPair.Entity;
                    }
                }

                throw new Exception("GetTriggeredEntity didn't find correct entity.");
            }
#

I keep gettng exception all the time

#

what's more curious

#

with compound trigger events happen even if I don't trigger anything

#

oooh

#

looks like my physics body has empty buffer

#

I see now...

hushed lichen
#

I was going to ask about checking the contents of that buffer πŸ™‚ For loops over a collection behaving weirdly is in my experience almost always because of some unexpected thing with the contents

rustic rain
#

well, it's still doesn't make any sense

#

my trigger event happens

#

out of nowhere

#

also weird, that conversion even creates that buffer for non-compound

#

considering it has default internal capacity of 16

#

here's my compound collider

#

waaait a second

#

wtf

#

I can see now why my trigger happens out of nowhere

#

my physics body is living it's own life before game starts 🀣

gusty comet
# rotund token and what does your baker look like

Here's the Baker

var eventDones = AddBuffer<DecisionMakerEventDoneElement>();
            foreach (var eventDoneList in authoring.EventDoneInstances)
            {
                foreach (var eventDone in eventDoneList.EventList)
                {
                    eventDones.Add(new DecisionMakerEventDoneElement
                    {
                        Entity = GetEntity(eventDone)
                    });
                }
            }

And DecisionMakerEventDoneElement is just an Entity reference to an Entity whose System represents a block of logic. Like an event

#

Here's the definition

[InternalBufferCapacity(0)]
    public struct DecisionMakerEventDoneElement : IBufferElementData
    {
        public Entity Entity;
    }

rotund token
rustic rain
#

what is it called, so I can look it up later?

rotund token
#

just a window that looks like this that let's you override capacities

#

it basically just overrides typemanager data before anything uses it

rustic rain
#

good stuff

karmic basin
frosty siren
#

How can we create entities in baking system?

rotund token
#

with great effort πŸ˜„

#

tldr: you need to add a SceneSection sharedcomponent

#

to associated with a subscene

rustic rain
#

Too much pain

#

Create all you want in baker instead

frosty siren
# rustic rain Don`t

Ok. By some reason my particular singleton component doesn't exist in build so I looking for different ways of how I can bake my singleton. Have no ideas anymore because I use few singletons and all works fine, but particular one won't appear in build, spent an evening on that

rustic rain
#

How do you make this singleton?

frosty siren
#

Simple baker with zero fields. Works fine in editor

using Unity.Entities;
using UnityEngine;

namespace NSprites
{
    public class AnimationSettingsAuthoring : MonoBehaviour
    {
        private class AnimationSettingsBaker : Baker<AnimationSettingsAuthoring>
        {
            public override void Bake(AnimationSettingsAuthoring authoring)
            {
                AddComponent(new AnimationSettings
                {
                    idleHash = Animator.StringToHash("idle"),
                    walkHash = Animator.StringToHash("walk")
                });
            }
        }
    }
}
rustic rain
#

You don`t have any 'editoronly' tsgs??

frosty siren
#

No, all works fine in editor, but particular singleton doesn't exist in build

frosty siren
rustic rain
#

Do you have managed stripping??

frosty siren
#

No, I've finally found issue

#

Seems build crashes because system runs before subscene loaded and with new "all system updates without any require" system just accessing to not yet loaded singleton. I should account this new system behaviour.

rotund token
#

of having to put require for update on everything for your singletons

void girder
#

So is there no more Job.WidthCode() with ISystem?

#

Just making sure

rotund token
#

there is not

#

just use IJob

thorn trout
#

Where can i find tutorial for ecs 1.0?

calm edge
#

pinned messages

rustic rain
#

bruh

#

what is wrong with physics

#

my object collides with 1 collider

#

but some unrelated collider also gets collided

#

wtf

#

if I make more copies of collider

#

they also get trigger event

#

lol

#

3 colliders

#

collision happened here, yet all colliders are affected by ITriggerEventsJob (which removes PhysicsWorldIndex from them and why they don't get drawn AABB anymore)

frosty siren
#

baking runs also before build?

brave field
#

πŸ₯²Native containers in IComponentData still not supported yet?

rustic rain
brave field
brave field
#

πŸ€” Not sure. It just not working and failed to bake into subscene

rustic rain
#

well, it works for me

viral sonnet
#

hm, i don't think it's intended (yet) for bakers

#

i'm pretty sure bakers/subscenes are not aware of serializing nativelists

frigid crypt
#

I need some help with scene management in entities 1.0

#

I am able to load a scene but I'm not sure how can I unload the previous one

#

I have tried to use SceneManager.UnloadScene() but it does not seem to be working

calm edge
#

hmm, I'm using rivals character controller and firing slow projectiles so the relative velocity is important, but the character doesn't update physics velocity, is there any way to get velocity out of it?

signal phoenix
calm edge
#

I added this:

                    float3 velocity = float3.zero;

                    if (parent.Value != Entity.Null)
                    {
                        if (SystemAPI.HasComponent<KinematicCharacterBody>(parent.Value))
                        {
                            var body = SystemAPI.GetComponent<KinematicCharacterBody>(parent.Value);
                            velocity = body.RelativeVelocity;
                        }
                    }
#

but the HasComponent is throwing InvalidOperationException: No suitable code replacement generated, this is either due to generators failing, or lack of support in your current context

signal phoenix
#

Hmm, I haven't encountered that one yet but you could try an editor restart

calm edge
#

no difference 😦

signal phoenix
#

Are you making the call to SystemAPI inside a system, or is it inside a job or a static method?

#

If you need this in a job, try passing a ComponentLookup<KinematicCharacterBody> instead and replace SystemAPI calls with that

calm edge
#

ah ok

#

yep that's all working now

thorn trout
#

is using a box collider per tile enough for a ECS voxel engine? It is for a game like v-rising and without colliders i don`t know how to make rival controller collide with chunks

#

It is for a multiplayer game, i need all colliders spawned

#

What is the best way?

stiff mesa
#

Hey everyone. A question to folks who have more experience with DOTS than me. When do I use managed systems, and when do I use unmanaged?

balmy thistle
#

use unmanaged whenever possible and unmanaged when you must interact with managed objects/APIs

rustic rain
balmy thistle
#

make ISystem what?

rustic rain
#

unmanaged system, even if you interact with managed components/api

#

just no burst

balmy thistle
#

if you can restrict it to not interfere with the update, sure

rustic rain
#

why can't I use managed in update?

rotund token
rustic rain
rotund token
#

from my experience yes

#

also it's just more flexible so why not

rustic rain
#

quite odd

rotund token
#

obviously you should aim to make everything bursted

rustic rain
#

can't make Animator bursted πŸ˜…

rotund token
#

or can you?!

rustic rain
#

πŸ€”

#

if you know smth, don't hide

rotund token
#

well, much of the animator is just wrapping native calls so i expect it'd be quite possible to call it from burst if you really tried (not in a job)

#

not that i would suggest doing this, just wait for a new animation system, way too much effort

rustic rain
#

so not only I'd have to wait for animation package, but also for 2d support

rotund token
#

i'll be honest, i know nothing about 2d animation requirements
i'm surprised the animator is even used though?

misty wedge
#

Just don't animate anything

#

ezpz

#

Since I have 0$ graphics budget I just use a really simple state machine for sprite animations

#

epic

rotund token
#
0x00007FFC8082B20D (RecastNavigation) [I:\Documents\BovineLabs\com.bovinelabs.shattered\Packages\com.bovinelabs.navigation\RecastNavigation~\Navigation.cpp:250] NavMeshGetTileRefAt 
0x00000252EA090876 (Mono JIT Code) (wrapper managed-to-native) BovineLabs.Recast.Interlop.Detour:NavMeshGetTileRefAt (BovineLabs.Recast.Interlop.DTNavMesh,int,int,int)
0x00000252EA090663 (Mono JIT Code) [I:\Documents\BovineLabs\com.bovinelabs.shattered\Packages\com.bovinelabs.navigation\BovineLabs.Recast\Interlop\DTNavMesh.cs:74] BovineLabs.Recast.Interlop.DTNavMesh:GetTileRefAt (int,int,int) ```
#

i write 2 lines of c++

#

and i crash my game 😐

misty wedge
#

That's what you get for being unfaithful to C#

hushed lichen
#

C# is a vengeful mistress, for she was created by Microsoft

oblique cosmos
#

Can confirm, I tried coding something in Java once and instantly my bathroom exploded.

#

(May or may not be a true story)

hushed lichen
#

That's why you go Java->C#
Java doesn't give a shit what you do when you're done with it.

rustic rain
rotund token
#

if you do it with playables you have built in support for netcode

misty wedge
rotund token
#

think timeline

#

netcodes new hybrid / presentation system supports this

misty wedge
#

I was wondering, since there is no dots animation system yet

#

Or is that just unused code

misty wedge
rotund token
#

oh yeah

#

they have a kind of hybrid animations system

#

completely undocumented

#

add a
GhostPresentationGameObjectAuthoring script

#

and then a GhostAnimationController

#

and you have a networked hybrid entities animation solution

rustic rain
#

is there same but for single player?

rotund token
#

their implementation is very similar to how my old hybrid implementation worked

#

except they added a layer of netcode for prediction etc via custom playable nodes

misty wedge
rotund token
#

let's you animate via an animator / playable graph with netcode prediction support

safe lintel
#

is there an equivalent EndSimulationEntityCommandBufferSystem for baking systems?

rotund token
#

there are no command buffer systems setup in baking world

#

you could setup one but probably advised to just complete and playback on the spot

safe lintel
#

also for animation ive been spending a lot of time with bendzae's simple dots animation repo, id recommend it if you didnt want to use kinemation

#

(although its 3d only)

rotund token
#

it still doesn't support blending right?

safe lintel
#

ive added it and rootmotion support on my own fork

#

tbh rootmotion was kind of breaking my brain, and no guarentees to how good/perfect my implementations of either rootmotion calc or blending is, but it works

rotund token
#

people still use root motion?

#

hopefully not on the actual player

safe lintel
rotund token
#

i thought this was mostly avoided these days for inverse techniques like motion matching

#

because root motion usually feels awful

safe lintel
#

well im fairly certain id have no idea how to do motion matching πŸ₯²

rotund token
#

sadly same

#

i'm really hoping unitys new animation system isn't just a rewrite

#

and is a whole new modern implementation of animation

#

but i fear it'll just be another blend / state machine implementation

rustic rain
#

well, there is a fallback

#

we can use Latios kek

rotund token
#

(it's fine if that side is also included but i want more)

safe lintel
#

did you look at the old com.unity.animation package?

rotund token
#

it had a burstable timeline implementation!

safe lintel
#

latios is too hard for me to debug to use it

#

the dataflowgraph setup seemed very different from what exists for mecanim but i havent really used playable graphs to tell if its that different

rotund token
#

i think dfg was flawed

#

and probably led to the whole thing being rewritten

#

(not the concept, the implementation)

safe lintel
#

how so? i did see right before they announced 0.5 stuff it was rewritten fully bursted

#

impression was first release was like conversion, second that we havent seen maybe refined like baking? wild guess though

rotund token
#

so that'd be the first step to fixing it

rotund token
#

good

safe lintel
#

TemporaryBakingType can be used with buffers right?

rustic rain
#

yeah

robust scaffold
#

@signal phoenix Does your character controller allow for the case where characters can push dynamic bodies but not get pushed by them? Does that even make sense?

rotund token
#

isn't that just a kinematic?

robust scaffold
# rotund token isn't that just a kinematic?

In the case where the pushed dynamic object can no longer be pushed, like against a corner, the player character should also stop like a dynamic object. Otherwise, it should act as a kinematic object.

#

My understanding of physics engines can't see a way this is possible. Maybe a smaller dynamic body within a kinematic body that detects if the kinematic is overlapping a dynamic body, in the case where an opposing dynamic can no longer be pushed, overrides positional data of the complete character. But the issue then arises in cases where two characters collide.

#

Rival prevents a kinematic object from phasing through walls and other characters on collision and also prevents characters from being pushed, which is good. But what happens when a Character - Dynamic - Character interaction, where two character controllers sandwich a dynamic rigidbody between the two and one attempts to push against the dynamic body.

rotund token
#

I haven't tried rival but this behavior worked fine in the unity physics character controller sample if I recall

#

And works fine on our controller at work on legacy physics

robust scaffold
#

Yea, Im trying to see if rival supports it

safe lintel
#

is it even worth scheduling a job only to complete it immediately after scheduling vs running it in an isystem?

#

(in the case of using ecbs/playback)

rustic rain
robust scaffold
#

This is great. Now I'm gonna have to figure out how to implement a 2D top down format.

rotund token
#

To avoid scheduling

safe lintel
#

yeah I figured as much. actually having difficulty finding where baking shows up when profiling the editor

rotund token
#

If it's baking usually you can just systemapi query

#

You can definitely profile it in editor though

#

But I think it has to be on an open subscene so it's the main process running it

safe lintel
#

ahh open the subscene

rotund token
#

Closed subscenes bake in a separate process

#

I usually just turn on editor profiler

#

Open subscene

#

Soon as lock disappears pause profiler

robust scaffold
#

Okay, a bit more experimenting with rivals. A character with dynamic physics enabled, physics set to collide, and an infinite mass results in a body that can push dynamics against walls and not through them but not be pushed by them or other characters. Exactly what I want. Now for more testing to see if this set of probably unintended settings causes physics to explode

#

The main issue I'm seeing right now, dont know if it's resulting from this set of parameters, is that dynamic rigidbody movement (not characters) are very poorly interpolated.

#

Oh wait, might be because physics baking is broken. Thanks unity.

light badger
# robust scaffold <@1021403886688424006> Does your character controller allow for the case where c...

(just saw your new reply above, but answering anyway)

I think this would be possible:

Make sure SimulatedDynamic is enabled on your character. Then, in your character aspect, customize the OverrideDynamicHitMasses callback so that the character has a characterMass.InverseMass of 0f (infinite mass). The Basic sample character does something similar in its BasicCharacterAspect.OverrideDynamicHitMasses in order to make the vehicle act like it has an infinite mass for pushing the character.

However, with that change, your character will now be pushing things without slowing down at all. If you want pushing to still take masses into account, there might be a way to calculate new InverseMasses for both the character and the other object in OverrideDynamicHitMasses in a way where if the relative velocity between the two would be pushing against the character, the character would be given an infinite mass, but if not, the regular mass ratio would be kept (we'd have to try it in practice, I've never actually tried it)

robust scaffold
rotund token
#

i should have recorded this in higher resolution

misty wedge
#

Very cool

#

I fear I'll have to switch to a navmesh approach someday too

#

Grids are really annoying in a number of situations

late mural
#

wondering is there anyway to make sure an IJobEntity is finished running?

rotund token
#

Complete()

late mural
#

ah thanks!

late mural
rotund token
#

jobs return a jobhandle

#

by default this can be hidden for ijobentity

#

but if you do like
state.dependency = yourjob.schedule(state.dependency)

#

then call state.dependency.complete()

#

it'll stall mainthread until that job is complete

late mural
#

ok thanks a ton!

rotund token
#

ideally you avoid this as it's not good for performance but sometimes it's necessary

late mural
#

How bad for performance is it, as i have about 10 of a certain type of component, and every now and again it needs to grab these components and use them immediately, but these components never change, so should i instead just store this list of components on a singleton component? (and note i only need to read the component data which should never change)

robust scaffold
viral sonnet
#

hard to tell. what's bad about it is no further jobs get scheduled.

late mural
#

fascinating, ill definitely profile it, and mess around with it, thanks for the info yall

robust scaffold
robust scaffold
# light badger (just saw your new reply above, but answering anyway) I think this would be pos...

For one, in BakedSubSceneReferencePropertyDrawer, I would replace
var sceneField = new PropertyField(property.FindPropertyRelative("SceneAsset"), property.name);
with var sceneField = new PropertyField(property.FindPropertyRelative(nameof(BakedSubSceneReference.SceneAsset)));
which allows for editor side validation of inspector registration. In case someone wants to edit the name of "SceneAsset" and not wonder why the inspector suddenly broke from the renaming.

robust scaffold
late mural
#

wondering how i would make an entity the child of another, guessing using state.EntityManager.GetBuffer<Child>(SomeParentEntity).Add(???), although i cannot workout what to replace the question marks with?

rotund token
#

i think you just add a Parent component to the child with the parent entity in the field

late mural
#

oh ok, thanks a ton!

rotund token
#

(i don't do much in the way of hierarchies though)

#

oh nice query builder has AddAdditionalQuery

robust scaffold
rotund token
#

you've always been able to combine multiple queries into 1

#
                new EntityQueryDesc { All, Any, None etc },
                new EntityQueryDesc { All, Any, None etc }
            );```
robust scaffold
#

Just an easier way to append components of an existing query onto a new query?

rotund token
#

how you would classically do it

#

this query would return entities from either subquery

#
                .WithAll<NavMeshSurface>().WithNone<WorldReference>()
                .AddAdditionalQuery()
                .WithAll<WorldReference>().WithNone<NavMeshSurface>()
                .Build();```
#

i'm using it like this

#

the old state.GetEntityQuery( isn't burst compatible because it takes params/array

robust scaffold
#

Oh, a union query rather than intersection if the WithAlls were merged.

rotund token
#

yep

#

it's a union of queries

robust scaffold
#

Interesting, let me see if that's relevant for anything I'm doing. I can see how that's useful

rotund token
#

it's somewhat of a niche feature that has existed for a long time

#

but it's useful when you need it

robust scaffold
#

I swear I wanted to do something along those lines, a union query, but I managed to implement the system using a classic intersection with a roundabout way of component querying.

#

But I cant find it anymore, oh well. Good to know it exists.

late mural
#

im getting this error, but i swear im initializing the random struct correctly: ```cs
[BurstCompile]
public void OnStartRunning(ref SystemState state)
{
ref ChunkMaster MapInfo = ref SystemAPI.GetSingletonRW<ChunkMaster>().ValueRW; // ChunkMaster is my component that contains the random struct aswell as a few other bits and pieces for generating the map

    MapInfo.Seed = (uint)UnityEngine.Random.Range(0, MapInfo.MaxSeed);

    MapInfo.RandStruct = new Unity.Mathematics.Random(MapInfo.Seed);
}
rotund token
#

you can't use UnityEngine random in burst

#

you have to use mathematics.random

late mural
#

ah, ill just unburst that function for now then...

rotund token
#

oh wait

#

thats not even your error

#

your error is you're passing 0 to mathetmatics random

#

you cant use a 0 seed

#

.Range(1, MapInfo.MaxSeed);

#

should be that at minimum

#

but this also implies your MaxSeed is likely 0 atm

late mural
#

oh ok thanks a ton!

rotund token
#

RandStruct = Random.CreateFromIndex(MapInfo.Seed)

#

it works for 0 to uint.maxvalue-1

late mural
#

ok ill use that thanks

#

still getting the error, and MaxSeed is definitely not 0

#

hmm it seems that seed is always set to 0, weird

#

by manually changing the rand struct's state to 1 it gets rid of the error message, how odd

rotund token
#

(i still dont think yo ucan use Unityengine random in burst)

late mural
#

i removed the burst compile attribute, that should be right, right?

rotund token
#

hmm

#

debug out MapInfo.Seed after you write it

#

and before the other rand call

late mural
#

ok!

#

the debug log never got called... what???

rotund token
#

yeah so im wondering if you're using this MapInfo rand struct somewhere

#

and this onstart method is just never called to set it up

late mural
#

no, as the error only occurs during chunk generation, which i have setup to only run when the player moves, the error only pops up then

#

any ideas why OnStartRunning() aint getting ran?

rotund token
#

sure system signature

#

: ISystem, ISystemStartStop etc

late mural
#

ISystem

rotund token
#

yeah on start running isn't called unless you also implement ISystemStartStop