#archived-dots
1 messages · Page 156 of 1
@opaque ledge I get this error on ceonversion: "No sharedMesh assigned to Unity.Physics.MeshCollider on Path_Pillar_Prefab"
yes I am using GameObjectConversionUtility.ConvertGameObjectHierarchy(variant, settings);
and it worked fine until I installed the physics package
hmm, there should be DOTS->Physics->Convert(or something like that), on latest physic package many things change, so for old stuff to work you have to do that
maybe it will help
I will try although I have no custom physics code atm
its for converting physic materials, not for custom physics code afaik, nevertheless, hope it helps^^
I dont even have this option after installing the physics package
I also had to change this line:
GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, null);
to this:
GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, new BlobAssetStore());
otherwise I get another error
I found the error. The prefabs MeshCollider was missing a mesh. Thought I checked that 🙄
sifting through the dots physics forum but can't seem to find it, how can I create a proper PhysicsCollider (let's say a cube) at runtime ?
^ for already created entities
@dull copper they were talking about "removing safety checks" on some burst stuff
as there been any test on that?
given that current ECS jobs are like 90% overhead in small projects
yeah, they need to sort it out, and its not even just an ECS issue, the schedule of an IJob without ECS is still at minimum 0.0040 on my machine but more likely 0.0100+ ms which is just not good enough. If the same job is repeated (unlikely to happen in ECS) then i can get down to ~0.0004 to 0.0009. But yeah, most of the time you're looking at the worse case. especially once you start adding the ECS stuff on top, iterating chunks, filtering archetypes etc.
at that speed (100 per milisecond), we are on the scale of... ue4 blueprint Tick overhead
so thats not that bad
problem was the 0.1-0.2 ms i was seeing last time
Well my game currently has about 200-300 systems, some systems also run multiple times in a frame
So the overhead quickly becomes very noticeable
is it the overhead of systems or the overhead of scheduling the jobs
like you i have a ton of systems, and im code gening out more of them
Well mostly iterating over small entity counts is just way to expensive
NetCode generates spawning systems which dont do anything but take 0.01 ms
yea my net code kinda does the same
Im just waiting for burstable systems so i can rewrite the gen code myself lol
can you instantiate a LinkedEntityGroup ? or do you need to instantiate each entity of the group manually ?
if you instantiate a prefab entity that has a linked entity group they will all be instantiated
hemm what's the way to remove a dynamic buffer from an entity ?
just RemoveComponent ?
Do the FixedRateUtils currently released work?
Turns out the simple fixed update manager dosnt work
have to use the catch up one for now
is this really the latest way of doing collider casts in Unity Physics?
or have I missed a piece of documentation
just in a system make a public field
store the physics world sustem
and the collider
ooh i get what you are saying, like prestore the input
and just change it accordingly
cool cool ty
has anyone had any trouble using 2 physics shape on the same object?
the collider input onwards is fast and burst compatable i belive so dont worry about that
is it normal that haviong 2 physics shape on the same object doesnt work?
i think its possible but not simple
you need to use a composite collider i think
so like
when the frog lands on the lilypad
it stops it
but I want to somehow tell the other in the same lane too stop too
so im struggling between 1. using multiple colliders one small one big that fills the entire lane
- or at the time of landing, collidercast the ground to stop all in the same lane
guessing the second one is more efficient since I would only do collisions checks once at the time of landing right?
not sure sorry
personally ill have a lane entity
that each lilypad has a reference 2
and set a bool or tag on that to tell it to stop moving all pads in the lane
nice ty
What's the most used way for transferring information between components and systems in ECS? For instance, say I have a wall and a ball - if the ball collides with the wall, then I want it to destroy the wall, or decrease its strength. What I have in mind to solve this kind of problem is the following:
Create a component such as WallHit which contains the following fields:
isHitting,force
This component would be added to the ball, withisHitting = trueand the hit force. The same component would be added to all walls, withisHitting = false. I would then have aWallHitDetectionSystemwhich loops through theWallHitandTranslationcomponents. If it finds aisHitting = true, then I compare that position from all others to find the component of the wall that was hit, and setforce. Then, I would need another system, such asWallHitSystemlooping throughWallHitandWallComponentcomponents to apply theforceto the wall structure.
Is this a good way of doing this? Is there a better method?
you can just use trigger events
@wary ibex component doesnt work well
for example, what happens if a ball collides with 2 walls
or a wall gets hit by 2 balls
a much better way of doing this is through events of some sort
either an explicity collision queue, or creating new entities representing the collision event
collision queue is more rigid but can all be done multithreaded
creating new entities is most flexible and extensible, but it needs a sync point
btw, creating entities will also be cheaper than modifying existing ones
creating new entities is most flexible and extensible, but it needs a sync point
@vagrant surge u can avoid job forced completion by sync points using ECBs
i know u know it, just repeat info for others))
Did burst 1.4 got removed? I cannot open the docs anymore
still shows up here https://packages.unity.com/com.unity.burst
hey. Whats the best way to unload all ECS content and switch/load new scene ?
Make a demon lord system to conquer and destroy the entire world?
More seriously, did you try simply loading a new scene?
i mean.. that wont destroy entities since entity doesnt belong to a scene (except subscene i guess)
i probably would tag them "scene1Entity", "scene2Entity" etc
then delete the each entity with that tag once i am done with that scene
thats what i do at least
That'd do. So a batch remove with a query on that tag?
yeah, but apperantly when you are doing entityManager.Destroy(an_entity_query) doesnt work with entities that has linked entity group, so you have to destroy them one by one instead of thru query
yes entities are not destroyed, thats my problem
i disposed defaultworld and created a new one, seems to do the trick so far...
not sure whether there is a better option or not
well i do entityQuery.ToEntityArray, and i do ForEach on returned array and destroy it 1 by 1, maybe not the most efficient way but whatever
problem is that systems does not restart
and in my case they do create singletons etc...
you can expose it a public method named like "Restart" or "OnSceneEnd" and call it once your scene ends
yeah, but apperantly when you are doing entityManager.Destroy(an_entity_query) doesnt work with entities that has linked entity group, so you have to destroy them one by one instead of thru query
@opaque ledge I think it does work as long that all entities in the linked entity groups are collected by the query too
had the same problem recently
you can get a native array from the query and then destroy the native array
i dont think so, i actually tried that, but it gives error "the entity that is linked doesnt included in query"
this will also remove the linkedentities
it didnt work for me when i last tried 🤷
took me a while to figure that out
you have to first do query.toarray
and then put the array into the destroy method
not the query
i dont think so, i actually tried that, but it gives error "the entity that is linked doesnt included in query"
@opaque ledge afaik, this is because some entity in the query has a linked entity that doesn't match the query
hooo okay, that makes more sense Peaj 😄
not sure if it makes sense 🤔 but it worked 😉
ogod
I just searched for how to scale physics collider
this rabbithole is deep
and seems like there is no solution at all...
in short, don't do it
it's always been an issue with every physics engine I've used
also, why would you need to scale it?
i dunno, why wouldnt you want the option to scale it 🙂
unity (dots) physics being stateless could help on this though as there's no cached stuff
is there a way to "rebake" a collider and apply it to an entity ?
and I want to be able to move my grid(which contain tiles, and those tiles have colliders) and scale it; I don't want to do that all the time tho so I wouldn't mind just having the colliders be wrong until I want to redo them
normally, your objects don't need to change their scale
like, things don't usually just shrink
i think for the majority of cases it doesnt happen or the way it does can be handled with some size variations stored beforehand, but on the indie side of things you can do some fun stuff with adjusting scale on the fly so 🤷
so, is there a way to bake colliders ourselves ? the pile of systems handling the conversion is a big black box ^^'
its not a black box the code can be viewed
yea, but it's complicated af
well yeah but its not a black box
.>
can you make variations beforehand and store them rather than rebaking at runtime? i would imagine any rebaking of colliders during the game could incur hiccups but ive not tested it personally
would really probably be done in job on another thread if done at all, because it's not something that need to be done absolutly imediately
and nah can't know the new scales before runtime
I guess I'll just reconvert a go and make it an entity prefab for the new scale
and steal the collider off it
that's not that dumb of a way actually 
1 conversion isn't that costly
A component with type:Child [B] has not been added to the entity. what does that [B] mean? I'm trying to access child buffer on an entity which definitely has the buffer, but unity disagrees.
If i'm new to Unity, should I wait until the 2020 releases or basically, more things support dots, before bothering to learn dots? so i can focus on the bigger picture.
you're going to wait a long ass time if you do that @lean cedar
dots prod-ready is 2022+
you still can do alot now
just need to invent workarounds sometimes 😁
(like for my physics collider scale problem earlier)
@lean cedar if you're new to unity id ignore it for the time being. job system and burst if you're feeling adventurous, entities if youre feeling a little masochistic 🙃
theres so much to learn and then so much thats in flux, i cant imagine learning dots ecosystem as it stands while being a newcomer to unity
I kinda did 
worked with go for +-4 months for a project for uni, then I looked into dots and it looked back at me 
the first few weeks were rough ngl
putting to the trash the whole concept of reference types was rly hard, cuz I only ever worked with OOP languages before
well the concept of entities didn't sound complicated to me, but i'm thinking that I should wait until i comfty with Unity because all guides I lookup won't be in dots.
one thing is, you will find very few up to date dots tutorials
tbh dots sounds exciting, but I wanna get moving on my project
yea don't start a first project will dots
the learning curve is wayyyy higher than regular unity
if you were just having fun in the engine, then why not; but if you want to get stuff done keep dots for later
yea don't start a first project will dots
@zinc plinth Why? Quite the opposite, DOTS is more useful for learning. Yes, it will take more time, but it will make understanding of programming much deeper.
ok. maybe after I complete the project i'll try to convert it.
dots sounds like it's just a Model and Controller kind of deal from web stuff with some c# interfaces
@eternal ice but if you're graded for a project you don't want to lose time
I rather give back a mess that works great than clockwork engineering that does nothing
no this is a personal project
ha ok
and it's mostly a visual text editor that i'm making. an IDE i guess for modding the XML of a game.
so mostly it'll just be UI elements
and scripts
no physics or rigid bodies
dots doesn't do UI yet, so you're kinda out of luck
well that answers that then
yup
ok ty
np 👍
Perhaps in you project Xamarin is better for you?
There is still a rather interesting project under development uiforia.io
It lets you do UI with XML in Unity
@eternal ice well considering navmesh, animation and audio are more or less non existent or so work in progress that you would be better off rolling your own(or use the builtin which werent you trying to avoid by using dots), and rendering lacks critical things like more than a single light for urp, no lightmap baking, v2 super buggy, id say theres plenty of good reasons someone new should avoid it, just off the top of my head
if youre a beginner and want to build a project, easiest thing would be to just ignore it.
@safe lintel I am making a mobile game with a rather large number of units on the screen in the mode of constant search for the path and avoiding obstacles, and almost all units change the goal every frame.
DOTS is my only option ...
And to be honest, I'm even glad about it. I learned a lot of interesting subtleties of the engine. I wrote his shader animator and renderer of dynamic units, as well as static renderer. Bypassed the avoidance of obstructions through physical callers. Through NavQuery did a search for the path. And completed a lot of calculations through SIMD.
It's fun to understand that you are one step better at understanding the tool you are working with.
damn, that's cool that you were able to use some simd
It was hard to figure out how to choose the best values and indices, but it was worth the x3 execution speed ...
honestly you already sound fairly advanced unless you also started learning unity at the time as well? sounds like it was the right choice for you though
I have been working with Unity for quite some time. But over the last year of studying DOTS, I rethought OOP and began to better understand the basic structures and the interaction of the software with hard parts.
just saying that imo a beginner to unity should steer away from dots for now 🙂
Maybe. As a self-taught programmer, I have always lacked some fundamental knowledge, and DOTS forces me to fill these knowledge gaps. If you have enough time to study, then when choosing OOP or DOD, the latter will be more profitable.
i do think in the future dots will be far more appealing than gameobjects and oop, the paradigm of systems and components just seems like it will make more sense to newcomers
i dont think so, but why?
honestly it just "seems" like not the correct way
i guess its a syntom of the library being on beta
Unity Physics and Havok Physics are pretty low-level stuff. I don’t think that they will soon change their api towards providing "safe" structs.
Unity Physics and Havok Physics are pretty low-level stuff. I don’t think that they will soon change their api towards providing "safe" structs.
@eternal ice guessing I should not asume that just because the "disable unsafe code" is unchecked it needs to be wrong somehow
new to unity
If you look at what's under the hood of Span and many other .NET structures, you will find a lot of unsafe code. If you act with him as part of a documented case, they will be as safe as the rest of the code.
"C#" is an excellent language since It gives two layers of api. Safe with garbage collection and other features and Unsafe which allows you to get a little closer to a clean "C" with manual memory allocation, working with pointers, allowing you to achieve significant performance.
"disable unsafe code" says that you agree to switch to advanced mode with С#. In principle, it is just as safe, but it allows you to do more things, some of which can break something. As Uncle Ben said to Peter Parker: "With great power there must also come great responsibility"
yeah I understand, I come from C its just that I because I had to tick a box in the UI my PTSD triggered lmao
but now I know that it can be done and its better that way
You can create an Assembly Definition in some folder specifying Allow ‘unsafe’ code to separate the unsafe part from the safe
good luck
anyone knows why after adding [NativeDisableUnsafePtrRestriction] to this struct
public struct DracoJob : IJob {
[NativeDisableUnsafePtrRestriction]
public NativeSlice<byte> data;
public IntPtr outMesh;
public int result;
public void Execute() {
DracoToUnityMesh* tmpMesh;
result = DecodeMeshForUnity(data.GetUnsafeReadOnlyPtr(), data.Length, &tmpMesh);
outMesh = (IntPtr)tmpMesh;
}
}
i still keep getting an error about unsafe pointers not being allowed when calling the Run() function of the IJob?
Could someone please offer some guidance as to the best way to render skinned meshes with bones and animations that can still have things attached to them (swords/weapons/armor etc)
I'm wondering if this issue I'm having is due to the physics library or some part of it. I believe I'm doing everything correctly, but: I am applying gravity to the player towards the centre of the sphere (-normalize(playerPos - spherePos) * gravity) and it seems like whenever I jump, the player is attracted to either of the poles instead of landing where it jumped from. Also, when I get close to the equator line, I just get put into orbit. I don't think it's just an issue with friction because as I said when I jump, I land in a different spot. I'm just confused as to why that happens.
can I use the 2D entities package without project Tiny?
hiyall, anyone using the visual editor for dots? how far is it from v1?
@gray copper in 2021 version.
is that delayed? @deft stump
delayed would be an understatement
The beta releases are still adding APIs so im a bit worried about the stability once it releases
A Hybrid Renderer V2 batch is using a pass from the shader "Shader Graphs/New Shader Graph", which is not SRP batcher compatible. Only SRP batcher compatible passes are supported with the Hybrid Renderer.
@gusty comet because your NativeDisableUnsafePtrRestriction is positioned above the NativeSlice. Its a per-field thing, so you need to put it directly above the IntPtr outMesh
so 2D entities doesn't work without tiny? whyyyyyyy
going back to 2020.1 seems to have solved the hybrid crash i was having; same package versions/code.
yeah i was on 2020.2 last weekend, it blew everything up
Every few seconds I'm getting a 30 ms spike from garbage collection performed as part of "onperformculling"
my world is made up of ~100k entities with meshes, of which almost none are ever moving, so I'm wondering if this is normal or maybe I'm doing something wrong
nvm, after turning off all dots safety checks it stops.
hey guys, should I stay away from using other render pipelines aside from the Standard with DOTS? or is it all 'supposed' to work atm
i would stay away, they're overhauling hybrid rendering right now and its not stable.
is there a way to use ConvertGameObjectsToEntitiesField in a system instead of inside a IConvertGameObjectToEntity's Convert ?
it asks for a GameObjectConversionSystem but I don't know what to provide it
ive never heard of ConvertGameObjectsToEntitiesField but a game object conversion system converts all instances of a MB when its found within a subscene.
eizenhorn talked a bit about it a few weeks ago, and how it was kilometers better than ConvertGameObjectHierarchy because it doesn't create a conversion world on each call
I really wish calling manually every system involved into the conversion of a specific object was easier and more transparent..
ConvertGameObjectsToEntitiesField would be even more efficient for me here because I have like 20 go trees I need to convert, not just one
what does it do?
takes an array of GO, spits out an array of entity
and it uses a single world for that
is this for runtime conversion? ideally you wouldnt convert anything, its all just baked into a subscene
yea runtime
basically I'm going around the problem of scaling for physics colliders by rebaking entities with the right scale as prefabs then to use for all the other stuff
its probably possible to rebuild/edit the colliders at runtime
maybe it is
but the code for it is not readable for me lol
rebuild definetely not afaik
I have my array of go prefabs that I Instantiate, set the right scale, then immediately convert to entity; add Prefab component to the entity, and store the entity away to use as prefab later
oh so i guess the scale depends of something at runtime
yea
what if you put a scale component on, and change that at runtime, the colliders dont consider it i assume?
^
I admit I'm completely overengineering this because I have no idea why I would ever change the scale
nah scale is baked into collider at convert time
FooData { currentScale = 1f; }
and tbh even if it's possible to edit scale @ runtime I'm not stepping into all of that shit https://i.imgur.com/7K7ctDJ.png
all of those types have diferent properties and ways they work
so big no
i edit scale at runtime its not that hard
yea
ecs & 2020.1 is enough madness for now without pulling my cpu appart 😁
owait
I have an idea 
what if instead of calling ConvertGOH 20 times, I create a empty GO, and put all my instantiated prefabs as children of it
and I just grab the Childs of that converted empty go lol
pog
im wrapping my ahead
about how your code is
because
I used prefabs
but i never use these funtions you talk about
whats
ConvertGOH
GameObjectConversionUtility.ConvertGameObjectHierarchy
it's because I do alot of runtime conversion without ConvertToEntity; while you would prefer for ConvertToEntity to do all the work for you >.>
I do that because I need to grab back the converted entity within that system's OnUpdate
and lilypadprefab looks like
this
i suppose we are doing different things for sure
i havent looked at your game
"Prefab" in editor is a GO, it gets converted to Entity at start time
yeah yeah its just that you can get that automatic
and I can't use that authoring mechanic because
1: I don't want an endless list of properties for every asset of my game
2: physicscollider problem
I have some codegen to generate a component with a property for every asset needed; and use reflexion to iterate and do work on each property
using Unity.Entities;
namespace Game.Scripts.ECS.Components.Grid {
// this file is auto-generated by GridPrefabsComponentCodeGen
public struct GridPrefabs : IComponentData {
public Entity GridTile;
public Entity GridMemberTest;
}
}
^ that thing stores all the currently good entity prefabs
yup but with codegen & without the automatic conversion
thats interesting ive never heard of codegen being used for unity
whats your use specifically?
what does it facilitate?
not writing properties that I will forget about by hand lol
my code for it is pretty trash ngl
yea definetely
I battled for days to get AssetBundles to get compiled within AssetPostProcessor to not have to rebuild them manually because I know I will forgot; that ended up not working
using Addressables now; and AssetDatabase for all that editor/codegen stuff
I have like an interface that I add to the "spawner/converter" component of every type of go I have; and the codegen just uses the getter set in that interface to know what to name the field in the component
so now the only risk is to accidentally edit that field in editor ^^'
it execs when an AssetDatabase reload is called(script compiling/editing assets & saving), you can then do magic stuff like this lol https://i.imgur.com/5Bz1AL9.png
there's a shitton of these methods too https://i.imgur.com/dfdrYw5.png
so i know nothing about normal unity lmao
there's a shitton of these methods too https://i.imgur.com/dfdrYw5.png
@zinc plinth i see
can someone help me with my game real quick
don't ask to ask
what
unless you wanna go recursive about it
i can whats up bro
don't ask to ask a question
its a problem thats been bugging me for days with scene management
ow shit is this DOTS related?
oboi, subscenes
no
you know where i could find someone who might?
then to #💻┃code-beginner you go; this is help for unity dots ❤️
@zealous shoal Use #🔎┃find-a-channel to find an appropriate channel to ask the question.

as I said
don't ask to ask
ask your specific problem so that people can actually help you
yea I meant in the right channel ofc
sure
i dont even know what dots is aha
but just in general
yes
at the left side
@zealous shoal Pick the channel and ask the question. Don't post off-topic.
@zealous shoal Pick the channel and ask the question. Don't post off-topic.
@glacial bolt thank you
Are there any samples updated for animation package 0.5.1 yet?
only requests for updated samples 😅 😒
does anyone know if the DOTS animation package uses instanced meshes, or if its just using dots to drive the animation calculations for a gameobject?
I have a question about "EntityQuery". It says in the documentation that "Get a NativeArray containing all the selected entities". How do I get the native array of those entities?
"ToEntityArray()" returns an array of the selected entities.
@deft stump do you have to dealocate it afterwards and if so how
wait don't answer that I know what I just did....
Since "IJobForEachWithEntity" is now obsolete
and the system reccomends that we use Entities.ForEach
How do I now get an Index for the Entity?
Nevermind found the answer to that as well..... I hope
Entity entity = entityManager.CreateEntity(typeof(Translation),typeof(LocalToWorld),typeof(RenderMesh),typeof(Scale),);
This code does not produce a visible entity on screen. is there something missing
Never Mind .... Found the answer
like int entityInQueryIndex in your foreach
Is there any point in using unity ecs in the next way:
simulate the game logic in ecs, but have actual gameobjects with animators and renderers that are controlled by the said simulation? Would it be better to just not use ecs at all?
Soo how would I have a 4D array as a 1D array?
yeah, the indexing is the same just extended to 4 ds
Protip: Make a helper to convert between flattened index and multidimensional coordinates so that your bugs can all be found in one file 👍
Any example though?
start with a 2d example then try to move it to 3d then add in the 4th
you'll find a pattern
A simple 2D array
[[0,1,2]
[3,4,5]
[6,7,8]]
accessed like arr[1][1] --> 4
You want to convert it into flattened 1D array
[0,1,2,3,4,5,6,7,8]
The difficult part is to convert between 1D flattened index and 2D position, but you should be able to think up the math, and there's tons of resources if you search a bit online.
Yeah I tried searching directly for 4D ones and didn't really find much on google.
It's quite easy actually. For 2d the 1d index is just (rowLength * columnIndex + rowIndex)
Yeah I know, I use 2D ones as well.
as you increase dimensions, you add the product of all rows/columns (this assumes rows and columns are fixed). i.e:
(accessingDimensionNumber-1) * (maxRows * maxColumns) + (rowLength * columnIndex + rowIndex)
😦
?
I wanted him to figure it out, tbh
Yeah honestly I rather want a working method to do it and just use it, I don't really have a reason to learn how it really works.
Not sure what you mean by "accessingDimensionNumber-1" and the difference between "maxRows" and "rowLength"
maxRows and rowLength are the same, sorry
and accessingDimensionNumber is actually the plane you're accessing (3D). Starting by 1
That's still 3D no?
yes it was a 3d example
ah
I still recommend you try to dig into how multi arrays work internally 'cuz it'll let you play around with them far better. If you want the easy way use https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.cast
@odd cipher
https://dotnetfiddle.net/CbT4uK
Thank you! I got it working
👍
Is it normal to have this warning when importing the entities package?
Library\PackageCache\com.unity.entities@0.11.1-preview.4\Unity.Entities\ApiCompatibilityLevelTest.cs(2,10): warning CS1030: #warning: 'Project is expected to have API Compatibility Level set to .NET Standard 2.0'
I thought it requires .Net 4?
.NET Framework 4.x (4.5+ IIRC) supports (is a superset of) .NET standard 2.0
.NET standard is more generic than .NET framework, .NET core, or the few other API compatabilities
So should I switch it back to 2.0?
Since you're getting a warning, that's probably a good idea
Alright, thx!
also, it seems like some things have changed since the time a tutorial that I watch was made, I can't find a GameObjectEntity component. Is there any place I can read about it?
Is there any up to date tutorial about hybrid approach where we can use the standard unity components along with the ecs?
Put "Convert To Entity" on the gameobject and any authoring components will be converted for ya. Also, one moment and I'll link a recent enough tutorial
Oh, "standard unity components along with the ecs?"
You mean link monobehaviors and entities?
yeah kinda
in the past there was that GameObjectEntity component that allowed to kinda link between systems and standard components. Why was it removed? Is there a different way now?
If you're starting from scratch, you should avoid that in general
Go for fully entity or fully gameobject objects
Hmmm... I thought a hybrid approach is a good idea. At least that's what I heard from other people...
For the time being you want to author, ie. build your objects in gameobject and convert them, and there are some things that must be gameobjects(particles), but if you link it too heavily you get less and less benefits from the DOTS model
Yeah, I realize that, but there's no other way at the moment. And I want my project to be transitionable to pure ecs in the future.
No way to achieve animation and particle systems via ecs
As much as possible, your gameobjects should have a convert to entity component with destroy gameobject or in an entity subscene (two different workflows, look them up if you want to), but for some things you might need convert to entity and inject gameobject.
Similarly, you want as much logic as possible in ECS vs gameobjects
"As much as possible" here means that, yeah, animation and particles, among others, must be elsewhere.
alright, I'll look it up.
thx!
I wish there was a full-fledged updated tutorial on dots, explaining how to get stuff done =/
Up to date playlist on some of the basics
https://www.youtube.com/playlist?list=PL-05SQhI5rIY2MVt5s_EfvddNXS2GNAtA
but that's more about pure ecs, is it not?
What I mean is like a tutorial about how they deal with these questionable topics like animations and stuff that is not yet implemented properly...
Aha
I think there are some of those in the sample project, but haven't looked into em myself
From what I've seen in the samples, they don't touch on anything like that. Maybe I should recheck it...🤔
Anyways, thanks for the info!
In general, as long as you have the reference to the entity that you're going to animate/entity from which you want particles, you can then you World.EntityManager.GetComponentData and such to get the appropriate data for setting animations and particles
I see
you dont need to use ECS stuff at all, just use structs and use bursted jobs for good performance
That's true, you can get a lot of perf simply by putting heavy work, or work that's done a lot into well-made and bursted jobs
depends on why you want to do DOTS in the first place, of course
It started from a question in general code. I was asking about an idea that I had a for a prototype. Basically this:
For ease of prototyping and to avoid rewriting code when I finish the prototyping phase, I wanted to use something similar to MVC pattern, where my character controller logic is separate from it's visual representation. In other words, there will be a script/s that handles movement, collisions, combat and many other character states. That will be the model. Then there will be a script that is responsible for view which can be extended via inheritance and stuff. For example a prototype capsule character's view script will respond to Model events, like movement and taking damage, by simply moving the capsule and changing it's color. While if I won't a full-fledged character with animations and stuff, I just need to extend that view script to respond to the Model with animations and such.
The point was to separate game logic from visual representation, in order to reuse code and split responsibility.
However, in response I've got many suggestions to just use ECS pattern, because that's the equivalent to MVC in gamdev. Now, the person that suggested that didn't mean dots explicitly, however after some research I found out that in the past it was possible to use a hybrid approach where you use Gameobjects mainly and delegate some of the functionality to the ecs systems. However, when I tried following one of the tutorials(from 2018) I found out that many things were changed leaving me now uncertain about how to proceed with this "hybrid" approach...
Specifically, I'm not sure what is the common approach now to sync data between ECS components and gameobject components. In the past there was that GameObjectEntity component that took care of both creating the ecs representation of the Transform and also synced back to it whenever a system updated the ecs representation of it...
the thing is.. DOTS is preview, and you have to figure out stuff on your own, if you dont have time for it simply dont go in 😄
to sync Transform-Translation, you should put "CopyTransformFromGameObject" or "CopyTransformToGameObject" depending on what way you want to sync
and you have to add a GameObject to entity thru entityManager.AddComponentObject(entity, new GameObject())
you can do that in an authoring component
Ah, that's what I was looking for!
👍
I wonder why they changed it from the GameObjectEntity approach. It seems like a step backwards to me =\
i am sure they have their reason 😛
such a shame that Unity dont have any samples to work with in an hybrid way, would help many people
yeah
Anyways, thanks for your input!
Now I know in what direction to move at least.
are collision filters in Unity Physics not a thing yet? I cant find any information about what collision filter the entity belongs to in the entity debugger, even though its an option you can set in the inspector
and, it doesn't seem to be filtering anything
Pretty sure you can do BelongsTo and CollidesWith, but no idea if it works?
right, yeah, you can set BelongsTo and CollidesWith in the inspector, but it doesn't seem to do anything
so is something not being propogated to the simulation? is there something in the authoring component that is missing?
yeah, this isn't a raycast, its literally dropping one entity on another and expecting it to fall through if not in the same filter
how did you test that CollidesWith wasnt doing anything?
guessing everyone is referring to this
I have Collision Response set to "Collide" - my objective is for certain things to collide and arrest movement and certain things to clip through. Is this a case where I'm a fool and don't know how regular unity works?
Well that does seem like what you have to do
But I dont think Collision Response is DOTS related is it?
Collision Response is for generating collision or trigger events🤔
Its confusing to discuss because the term collision is overloaded. I am attempting to create the following behavior:
3 Objects, 2 types: AAB. If I drop an A object it falls. if it hits another A it stops. It will fall right through a B object.
So by collision I'm referring to whatever Unity Physics is doing once I add Physics Shapes to prevent two objects from passing through each other. I don't think that's implemented with a monobehavior so surely it is DOTS related
A -------><-A A------B----->
that looks like you should be able to handle all that with only the COllidesWith tag
yes you can achieve this behavior with Collision Filter
do all entities have physicsshape?
so, experimentally, collideswith has no effect whatseover. go create some objects and set them all to collideswith: None. give some of them physics bodies so they fall. Observe they all collide, ignoring collidesWith
im gonna do exactly that
did you set belongsto correctly?🤔
works perfectly fine 🤔
show settings please
I guess you ahve to set the belongsto
too
but show shape settings please
i have plane that belongsTo A and 2 boxes that belongsTo B, plane can collide with everything, boxes can collide with A, but not with B
boxes clip through each other but collide with plane
first the ball, second is the platform
is this what you are talking about @tight blade ?
yeah, im observing what Magda is
we might be doing something wrong and just assuming the wording must do X
but IMO that SHOULD work like we expect it to
yeah because how can an object that belongsto and collideswith NOTHING still do that
even if you set both to nothing they still collide
is this a bug?
in my project it clips through 🤔
really?
really?
video
unity version?
im using all the newest
newest unity, newest libraries
Unity,Physics,ECS -> 2019.4.2f1, 0.4.0, 0.11.1
so it might be a problem with the newest unity physics library
cause our unity versions are differents
and the version JUST released
Well, we need to know drUiD's version first. I have the same behavior as you do
be back in a bit, I'm interested in finding this out, though
what the fuck
of course
what an idiot
i wasnt removing the other colliders that come with the default meshes
it works as intended now, thats probably what gearless is experiencing too
i suppose he wants something like this🤔
yep
other colliders? oh whaaat?
haaaaa
welp. that'll do it
Huh, I didn't realize those colliders were taken into account at all
other than calculating the physics shape during the conversion process
well, thank you both exceedingly. @frigid needle thank god you made that same error while reproing, or I may have never figured that out
@warped trail thank you for not making that mistake lol
😅 👍
Hey @frigid needle this is off topic and I'll move it to a DM if anyone else comes in with actual #archived-dots questions but: I like your post process toon shader! did you follow a tutorial or is that a Magda original?
oh man im not using any shaders 😦 i wish i knew
i just did my voxels in MagicaVoxel
and set the lighting to white and thats pretty much it
lil bit more intensity too
There's a number of shader graph tutorials for toon shaders. Not sure how compatible (ie. easy to get working) that is with DOTS, though
the problem with that is that
shaders graphs arent compatible with the standard pipeline, are they?
there is no standard pipeline, you mean built-in renderer ? then yeah, they are not compatible, shadergraph is only compatible with scriptable render pipelines which is lwrp/urp and hdrp right now
yeah thats what I meant
for the ones still interested
its possible to get scriptable pipelines with the hybrid renderer
unity 2020 + required
and the define symbol to be set too, to enable hybrid render v2
isn't v2 enabled by default on 2020.1 ?
i dont know
downloading it right now
probably is, although documentation says otherwise
nope
lies
all lies
lmao
does DOTS have a subreddit?
or an IRC or any other discussion platform?
there's the forum, but I guess here is where you'll get the most support
there's more Unity staff on the forums
but yeah, don't use reddit for DOTS
I mean you can but I bet you'll just have horrible time if you do that
urp 9.0.0 preview versions are
Can I treat world.SequenceNumber as a world ID?
in the world code it looks like it is set in the constructor and never changed
yup
i don't think it's guaranteed to be the same every time
i just want a way to say this gameobject belongs to this world
without each gameobject having a reference to world
yea seems safe enough then
or you'd have to subclass world
if you want to give a persistent id
speaking of worlds does anyone know what i need to do to automatically load subscenes into a custom world
Ooo
i've set DefaultGameObjectInjectionWorld but that doesn't seem to be enough
manually would be fine too i just have no idea what kind of magic subscenes are doing to replicate
ok so the first big issue i had
is you need a catalog.bin
which is made via the build, i cant seem to find a way to make them generate in editor mode
super annoying
whhaaat
how do you even find that out
so much code diving
and you have to use that new build pipline
heres what mine looks like
im not 100% sure if you need your subscenes in that list
isn't that the new outdated one since new new is script only
but i just added them
dude what
i have no clue
i thought it was the current one
yea they deprecated the build configs even tho they were only just added
[Platforms 0.3.0] - 2020-04-09
Build pipeline major overhaul: build pipelines are no longer asset based, and instead must be implemented in code by deriving from BuildPipelineBase class. Build steps are no longer mandatory but can still be used by deriving from BuildStepBase.
i made a build
yea no idea why
i dont know
ill just leave that for now
anyway
make a build
and check in your build data directory, the streaming assets folder
and steal its catalog.bin
and put that in your streaming assets in edotr
then to load you do:
var sceneSystem = _targetWorld.GetExistingSystem<SceneSystem>();
var sceneId = sceneSystem.GetSceneGUID("CoreGameAssets_SubScene");
_loadSceneEntity = sceneSystem.LoadSceneAsync(sceneId, new SceneSystem.LoadParameters()
{
Flags = SceneLoadFlags.LoadAdditive,
Priority = 1,
AutoLoad = true
});
to check to see if its done you can do sceneSystem.IsSceneLoaded(_loadSceneEntity)
god probably
i havnt touched it
ohman
unity
ahh i see
do you add other unity systems to your custom world
for subscenes
or just that one
um im using the default init stuff
kinda
look for
SceneSystemGroup
you need every system under that
i sure hope so
also
subscenes are very 'noisy'
like they bring in a ton of extra components on your stuff
what do you mean
ahh
i guess that's not too bad, would prob end up with the same if you wanna unload scenes anyway
i assume editorrenderdata doesn't end up in your build right
yea i guess my stuff is weird
ill just kill the whole world instead of unloading stuff
ah
but wanting to have 'realms' or some such feature
which each realm would be 1 world
what's a realm in this context
its a ton of fun to work on
but i keep messing with the core networking
almost got it happy
still ENet?
yup
nope
client server
like planetary annihilation
i just dont have the skills to do determinism
on top of all the other stuff
yea it'd prob be more work
definitly
i hope not
😛
they talked about their underlaying data tech
and i copied it
and there are a TON of optmizations i still need to do
like Fog Of War, only send unit info that you can actually see
oo
haven't seeen much about planetary annihilation but damn they even do replays
nice
yea
free perk of their networking data layer tech
i have replays too
but havnt saved/loaded it out yet
had a super annoying bug, and i could just 'scroll' back in time to see what was happening
ive actually broken that feature now, but will build it back into my proper debug tools soon
yea that sounds really useful for debugging
@ocean tundra btw thanks, seems adding the systems in SceneSystemGroup is what was needed to make Auto Load Scene work 👍
i just make them inside my scene
regular scene
and they have a property for Auto Load Scene on the monobehaviour
so when you load the regular unity scene it auto loads the subscenes in it
haven't tried yet but changing to it is the idea
starting in it seems to work so i assume changing also does
hmmm yea so thats probably what i missed
i should load the scene addictivly
and then try to load my sub scenes
might not need that weird catalog rubbish
yea
i plan to have scenes consisting of only subscenes so only have to worry about loading the actual scene instead of loading individual subscenes
and let unity handle loading subscenes
tho i don't think they automatically unload when you unload the scene but that's a problem for another day
i think the subscene entity has some sort of reference to scene
whoaa could be wrong but seems it does actually unload the entities when you unload scene
thought i read somewhere this wasn't planned because they don't want to assume your entities should disappear when you unload a unity scene
So disabling the presentation group dosnt hide the entities of that world
you using hybrid renderer?
yea
i remember something about it caching stuff so if you're disabling it at runtime it might not care
might have to add a DisableRendering tag to your entities
unless you're disabling before it ever runs in that case i dunno
[Platforms 0.3.0] - 2020-04-09
Build pipeline major overhaul: build pipelines are no longer asset based, and instead must be implemented in code by deriving from
BuildPipelineBaseclass. Build steps are no longer mandatory but can still be used by deriving fromBuildStepBase.
@hollow sorrel BuildPipeline are no longer asset based, BuilfConfiguration still is, before we had BuildPipeline and BuildSettings, now we have only BuildConfigurations (previously names BuildSettings)
A debugging question. Is there a way for me to track when certain change versions update?
There are some components that I'm pretty sure I'm not updating, but still seem to pass the ChangeVersionsFilter
I'm guessing there is some API call that changes the filter which i've missed, but there doesn't seem to be any tooling to debug this
This kind of stuff is tricky to debug isn't it. Two quick things - I think Eizenhorn mentioned that if you're doing anything with buffers they're marked changed every frame even if you only read? (I could be mis-remembering) and 2, there was some work on the forums for a generic reactive system thing which may help debug/test certain scnearios - https://forum.unity.com/threads/reactive-system-generic-way.919997/
Yeah, normally i'd set some sort of memory write breakpoint, but alas its all in native land
@amber flicker you can't tell when you write to a buffer because it's just an array
And overall there's an attribute in EM's method that say "this is a 'breaking' change"
Do you mean the StructuralChange attribute?
last i heard everything that is not marked as read-only (via In) has its change version updated, even if you don't do anything to it.
Is there any way to run pass a method for Entities.ForEach instead of the lambda within the same method?
@stiff skiff yea that one
@wary ibex there's codegen involved in Entities.ForEach, so I quite doubt you can do that
tho you can call your func in the lambda and have nothing else in it 
@zinc plinth note that that is slightly different from the change version stuff or the reactive systems Timboc is talking about
ha
a structural change is a change in archetype, or other change in data layout
I'm still trying to get into ecs, specifically the hybrid approach. And there's something I don't completely understand. In the docs for IComponentData it says the next thing:
Fields of an Entity type in the IComponentData are reflected as fields of GameObject types in the generated MonoBehaviour. GameObjects or Prefabs you assign to these fields are converted as referenced prefabs.
Does that mean that I can access the gameobject via an entity and call stuff like GetComponent and such from anywhere in my project that has access to that specific entity?
or what do they mean by "referenced prefabs" here?
Sounds like it does the conversion process on them, so you have a prefab entity with a pointer to a gameobject
Where did you even find that quote? I can't seem to find it
When you make an authoring component from an entity with an entity reference, the generated GO script has a field for another gameobject instead.
On conversion, if said gameobject is also converted, you get a reference to that.
I assume it otherwise does a copy-conversion and adds the Prefab tag to the generated (and referenced) entity
hmmm
Guess I just need to dive into the samples, since the docs just confuse me the more I read them 😄
Like I understand the Core ECS section more or less. But the Creating gameplay is just so abstract...
If they were to give some more concrete examples, that'd help a lot...
In other words, at authoring time you have a gameobject, and in the script you reference another gameobject.
If said object is in the scene and is converted, you just get a reference to that. (so you end up with two converted entities)
Otherwise you end up with your converted entity, plus a converted entity of the gameobject it pointed to. This second generated entity will have the Prefab component, which stops systems from affecting it (unless specifically told otherwise)
The easiest way to understand that is to make an empty project and some very basic components, really
As for
Does that mean that I can access the gameobject via an entity and call stuff like GetComponent and such from anywhere in my project that has access to that specific entity?
No
Unless you point to a convert-and-inject gameobject in your scene
But that's business as usual - convert and inject makes an entity and makes you able to access entity from GO and other way
Oh, I couldn't find a lot about that convert-and-inject thing in the docs... Is it documented anywhere?
Probably?
When you add the convert to entity script to a gameobject, you can either convert and destroy or convert and inject
I think there are other components you can add if you are doing other workflows, such as entity subscene
Yeah, I kinda got what it does from some unofficial videos and articles, but I just finished going through the latest docs version and there was literally not a single word about it...
at least not in the manual part. I bet there's something in the scripting api, but these review package scripting docs don't provide any description at all ><
guess I'll go back to code monkey's tutorials and sample scenes =/
what are you trying to do ?
just trying to understand the common workflow of communicating between ECS and non ecs stuff...
I realize that in ideal it's all gonna be ecs, but that's not the current state of affairs now, right?
you can always add a monobehaviour to your entity thru entityManager.AddComponentObject, and create systems that queries that class, however you need to run that system with WithoutBurst().Run()
you can also create a monobehaviour assign an entity field and check it's datas thru entity manager, could be great for UI, such as player hp etc.
you can also create a monobehaviour assign an entity field and check it's datas thru entity manager, could be great for UI, such as player hp etc.
@opaque ledge what's the common workflow for that? For assigning an entity to a monobehaviour.
is it done during the conversion?
when you create your entity 😄
Which is either during conversion or when you spawn it at runtime?
So I can create a component that holds a reference to monobehaviour?
yeah that too
A class ICD could do that, but it would be not optimal, and all interactions would be on main thread
public class MyComponent : IComponentData{
public MyClass Value;
}
I say "not optimal", but I don't think there's any other way
It just breaks the unity ECS model and is harder to reason about and debug
@willow plaza what would be your usecase for this
So IComponentData is really the one common workflow that most people use for that task?
@zinc plinth I don't have a use case yet, but if I were to say, probably to pass some data to the Animator component on a Gameobject
or like i said, you assign an entity to a monobehaviour and check its data on update method
It depends
it depends
it depends
//it depends
I think there's a Animator package for dots ?
i think Hodhandr tried to say "it depends"
@zinc plinth I had a look at it but it's really in the beginning stages of development and they even warn that you need to be "tech savy"...
As long as you have an Entity reference, you can access everything about that entity using the EntityManager, even from gameobjects.
Could probably even do it in random classes outside the unity game loop if you really wanted to break things.
I'd prefer to become "tech savy" rather than butcher ECS that way 😁
As for the other way... Same thing, kinda?
The simplest way i can think of is that your animated gameobject just has a reference to the entity and grabs all the data it needs from there
That way you don't dirty the ECS side, and updating the gameobject is not a responsibility any part of ECS should have
As long as you have an
Entityreference, you can access everything about that entity using the EntityManager, even from gameobjects.
Could probably even do it in random classes outside the unity game loop if you really wanted to break things.
@tawdry tree I guess that's what I wanted to hear. I always had this image that entities and gameonjects are kinda separated by this impenetrable wall...
yeah, unfortunately many people think like that because Unity has no example of it, but in reality it is pretty easy
i didnt know class ICD was a thing and i didnt know ForEach actually supported class ICDs
which makes things much easier 😄
ForEach needs .WithoutBurst() and .Run() to use any managed types, though. Which is... literally any class.
if its simple you can still go with Entity field in a monobehaviour and do stuff in Update method
I always had this image that entities and gameonjects are kinda separated by this impenetrable wall...
It's not exactly an impenetrable wall, but it is a wall, and by design and pattern, you could consider it a one-way mirror; gameobjects can see, but not change entities, while ECS doesn't know gameobjects exist.
If you separate things like that you should have minimal issues.
ForEach needs .WithoutBurst() and .Run() to use any managed types, though. Which is... literally any class.
@tawdry tree they have this piece of information documented very well, but not what you said earlier. 😄
That's a bit of a slip
"oh yeah you can use classes"
(forgets to mention class ICDs)
huuh, I can't find the animation package in the docs ?
@zinc plinth I think there's a pinned message to it's docs and samples.
it's super WIP, so not that surprising? If you're referring to the DOTS one
huuh thx
I was thinking of using it, but it's not quite clear how to deal with transitions between animations and states. I guess they expect us to implement our own state machine in ecs...
If you setup things as gameobjects and need to do custom things when making an entity(so not straight conversion), a MonoBehavior implementing the IConvertGameObjectToEntity is possibly the simplest way.
https://docs.unity3d.com/Packages/com.unity.entities@0.11/api/Unity.Entities.IConvertGameObjectToEntity.html
In short, the Convertoverload here will have access to both the gameobject (being a MonoBehavior), and the Entity being created, as well as the relevant EntityManager.
Alright, gotta experiment with that to understand it completely! Thanks for clarifying things again, people!
what is the general consensus on running jobs within jobs.
you cant, what are you trying to do ?
well, you cant 😄 something about determinism, there is a chapter in entities manual i think
I realized what I said, after I said it. I have entity and foreach entity I spawn new entities in a regular foreach loop. Furthermore the spawned entities spawn further entities. So 1->2->3
1 is the parent of 2s and 2 is the parnet of 3s
It wasn't a job but now I want to see if I could make it a job
it works but, sometimes I can't leave well enough alone
So the way I would go about handling this would be to create a job for 1s (right now only one is created but that is for testing purposes)
Have a native array returned from the job
have that array as input into the 2's job. this will create entity and set it's parent as one of the 1s
return a native array of those and feed that into the 3's job
?
yeah most likely something like that
do note however, if you are using command buffer to create your entities, they wont actually exist until they are playback later on, so if you are trying to put child entity to parent entity's data, it wont work
Hello I would like to have a world to use as "reset world" so that I can dispose of the actual worlds anytime and create new ones with the systems and entities of the "reset world" or default world if you prefer
is there a way to do so?
copying systems is not a problem as we do it already (maybe not the best way), but copying entities I am not sure
Custom bootstrap to get the type collection of systems you want. Create a empty world there to store the entities.
When you want to get a copy of it, you create a new world, init using those systems. Then do a bulk copy of the entities into that world
Since the world that is holding the entities is not updated the entities will stay in the form you initially place then e
Uh forgot the exact way, I'll look in a bit. I remember there being a entity manger transfer something something method
Oh there's a new one too for this actually
One moment
thank you
public void CopyAndReplaceEntitiesFrom(EntityManager srcEntityManager);
[StructuralChangeMethodAttribute]
public void CopyEntities(NativeArray<Entity> srcEntities, NativeArray<Entity> outputEntities);
public void CopyEntitiesFrom(EntityManager srcEntityManager, NativeArray<Entity> srcEntities, NativeArray<Entity> outputEntities = default);
all within entity manager, likely want the last one
to get the entity array you want to copy
Does someone know the performance implications of chunks?
like what exactly are they and what mantra should I keep in order to 'maintain' them correctly
they somehow group entitites right?
you don't really maintain chunks
are they like a linked list?
they are managed by the runtime
no they are fixed buffer of bytes, interpreted as a SOA
service oriented architecture?
structure of arrays
yes
and they prolly save entity info right?
like the pointers or something
or the IDS
once per whole structure
the ID array is included in the SOA
I don't know if the chunk archetype is actually stored within but it could be
it doesn't matter in the end
interesting so i guess the chunk archetype
is the struct thats being used
to save info in the chunk right
not exactly no
its only used to get the structs within to do a pointer offset for each of the arrays of each of the components + entity structs with the ID's
they do compacting as well so theres likely a id-offset array as well
yeah this is as fast as it gets
thank you June!
NICE, thats what I was looking for!
so entities in the same chunk = cache = good
thanks!
yep
Here's a terrible antipattern, "find the first n entities that fulfill the requirements".
I suppose this would be better with an entityquery and a nativearray?
but anyway, is there a way to break out of an entities foreach?
continue doesnt work of course.
return is a "continue"
what exactly do u want to accomplish with your code?
I guess EntityQuery.ToEntityArray() or something.
yeah ^
honestly it should be fast enough that its not a concern, if you have that many entities that it is a concern then yeah maybe consider adding another way of separating it into a different query?
In this case, "find the first player-owned Vessel entity that's not got a TagUIfocus"
(the code does something with the local variable afterwards)
in this context who is "frist" and who is second
first as in
the first that got instantiated?
what you are doing should be fine
although if i remeber correctly
you can filter foreach
WithChangeFilter is interesting I guess.
but probably throws the entire chunk at me.
Nope works great.
vessel != Entity.Null
yes.
That will run on every run but the 1st
I mean in SIMD code, you often try to be as branchless as possible. this code branches all the time. Could invert the if, but it's still smelly.
So I'd consider this foreach a total antipattern in DOTS.
obviously in this case it's harmless - player seldom owns more than 100 ships, more likely 5 or so.
I want a system that runs once whenever whenever an entity has LOST a certain tag.
But this query is illegal, because I can't filter for it AND ensure it's not there.
I guess I need to set up a tertiary tag, like "TagUnfocus" or something.
I don't want to interrupt/add noise to this conversation, but I have a question of a different kind to put out to everyone when this topic is winding down.
My topic is kinda wound down, ask away 😄
nice. sweet
I want to make "ice skates" style friction work in unity - by which I mean that when ice skates move laterally, they have more friction than when they move on the axis of the blade. Im not using it for ice skates, so if the topic moves into workarounds I can go into more detail about the use case.
but let me show a video of how drag works in unity physics now:
sorry I just filmed it on my phone, I dont have capture set up
but those are two cubes rotated 45 degrees with an initial X axis velocity of 5
one is, obviously, rotated 90 degrees against the axis
you can see the result is not the same as the way ice skates work, lol
yeah so
you basically want to reduce the velocity of an object IF its moving laterally
right?
so like based on the orientation
if its moving forward or backward its fine
but you want to lessen the effect of how it drifts side to side?
well, actually, I want to reduce the velocity of an object in proportion to the amount of contact its making with the friction surface
the amount of contact
this is actually for water, and the hulls of boats
if a boat is moving in line, there's less drag, which is why boat hulls are designed with a narrow profile
so your question is how do you simulate less drag if moving in a line?
so, if the answer is to homeroll the physics calculation, I can keep looking into it myself. I was mostly just wondering if theres like an option in unity physics that would make this easy and out of the box
good stuff
by the by, any idea whats going on with unity physics that causes that one cube thats moving laterally to just drift forever?
there must be some kind of dividing by zero situation going on lol
just another thing from your past question
i think you could simulate what you want
by adding angulardamping
so the engine could help you a little
if you are in a bout
well, angular damping is reducing angular velocity, no?
"turning" would be difficult
yes
if "turning" is diffucult
then moving laterally is too
just a thought
oh, I see, you're saying in general for a sailing sim. Yeah, I see what you mean
yeah, I'll keep it on the radar
in that video? I have the initial velocity set in the physics body authoring component in the inspector
so in theory
