#archived-code-advanced

1 messages · Page 55 of 1

undone coral
#

because this all is very confused

#

it sounds like you want a repeating background

#

and i'm trying to understand why it isn't duplicated. i understand you also want to achieve a wrapped world

#

which i know how to achieve

#

i understand what that means

iron torrent
#

It is not a repeating background

undone coral
#

you want the player to essentially move along the surface of a torus / cylinder

#

which is fine, that makes sense to me

#

is that correct?

iron torrent
#

no

undone coral
#

okay well, my feedback to you is you need to improve your communication skills

#

so what are you trying to achieve?

#

dont' talk about your existing implementation. what is the idea?

#

it is normal to have a lot of inertia around something that "Works" that you've "Already Written" and you "Just" need a solution to your "Problem Right Now"

#

try to answer my questions

iron torrent
#

I have explained what I am doing, I have a player at the edge of the world as represented in the Game View in that image. The game view not only needs to show the scene in that positon, but the scene on the other side of the scene or map.

iron torrent
iron torrent
undone coral
dusty wigeon
#

@iron torrent, I do not know what you mean by you can every so slightly see a lag or gap. I am not seeing it.

undone coral
#

focus on my questions

#

the idea of using multiple cameras is bad

iron torrent
undone coral
#

and you're sticking to it due to inertia

#

you can't use cinemachine the way you want

iron torrent
undone coral
#

right now, you're convinced you've achieved something better by not duplicating

#

but you are still duplicating

#

you're duplicating cameras

#

and you're going to still duplicate a lot of other stuff

#

you just don't know it yet

iron torrent
undone coral
#

and you're not answering the question

undone coral
#

well

#

listen if you don't inhabit reality

#

why are we helping you

iron torrent
undone coral
#

nobody can tell what is going on

#

not unity support, not us

#

and you're not helping us understanding

#

you're saying it's not a torus

#

it really, really really looksl ike you're trying to wrap the game map like civilization 2 wraps its world map

#

simple yes or no question: is that true?

#

are you trying to wrap your game world like civilization 2 does?

#

@iron torrent if you want to thrive at this, you're going to have to write 100x faster

#

it will probably be really interesting, whatever the mechanic is here

#

it probably isn't a torus

dusty wigeon
undone coral
#

alright well i think that was exhausted

#

it's been a bad few days huh

upbeat garden
#

Hello! For reasons, I’m thinking about storing a pointer to a MonoBehavior in one of my scripts. Not a reference, but an unsafe pointer.
Since that’s pretty unusual, I’m having trouble find out if that’s a safe thing to do in Unity. Does anyone know if Unity has commented on the safety of doing that before?

dusty wigeon
# iron torrent

That is really strange, and if you remove CineMachine it works ?

undone coral
upbeat garden
#

Trying to store a reference to a MonoBehaviour in an unmanaged struct.

#

But obviously that won’t work. Pointer would be the next go to

undone coral
upbeat garden
#

using an unmanaged struct would come with a lot of architectural advantages for me here. Too long to explain.
I’m looking for places where Unity has actually commented on this. Do you know of any?

#

Or, do you know why it’s not safe? Does Unity move GO data around at runtime?

undone coral
#

it really depends what your goals are. it sounds like you are making a lot of assumptions about how things work

#

that are wrong

upbeat garden
#

That’s why I’m asking

undone coral
#

it's been a really bad few days in the chat huh

upbeat garden
#

I don’t know. I haven’t been in here in years

#

Hope it’s going well

undone coral
#

you're obviously a normally adjusted guy

#

like why not say what the goal is in a sentence

#

why make that difficult

upbeat garden
#

I’m not here to argue or anything. Just looking for info on this specific question

undone coral
#

there isn't anything sensitive about this goal

#

by now you could have said what it is

upbeat garden
#

Is there a technical reason why storing a pointer to a GO Component would fail in some cases?

dusty wigeon
undone coral
#

just imagine it from my perspective

#

i'm a normal well adjusted guy. i'm asking you like, a basic question

#

anyone who would want to help you would need to know the answer to this basic question

dusty wigeon
undone coral
#

there isn't like

upbeat garden
#

Can you think of any reason why storing a pointer to a GO Component, and then trying to dereference it later (maybe frames later) would fail? Have Unity commented on this anywhere?

undone coral
#

an approach where you use deflection

#

you know what i mean?

#

you can't just ignore what i'm asking

#

i suppose if you want to do something that makes no sense, go ahead and try

iron torrent
#

Rectangle, each area is the size of one screen. And is a place holder to represent the world space in the scene.

undone coral
#

it sounds like you don't know what you're doing

upbeat garden
#

I’m not sure why.

#

But thank you for your help

undone coral
#

because almost 100% of your words are describing something flawed

upbeat garden
#

How come?

undone coral
#

@dusty wigeon it's really hard today

#

am i crazy?

undone coral
# upbeat garden How come?

i gave you the benefit of the doubt. it would help a lot to know what you are trying to do. it will help me understand your level of sophistication

#

otherwise you're just an anonymous person on the internet, it's hard to know

upbeat garden
#

I’m not sure what more information you’d have to have about my use case.

upbeat garden
#

I’d be glad to answer specific questions, if I can.

undone coral
#

i'm asking what you are trying to do, big picture

#

for example, "i am writing an editor script that replaces one script with another, keeping all the serialized values"

upbeat garden
#

Like, what my project is?

undone coral
#

or maybe "i'm trying to migrate a component at runtime"

#

YES

upbeat garden
#

Oh - I’m sorry, I can’t legally share that.

orchid marsh
undone coral
#

it is so bad today

upbeat garden
#

Is it ok to ask a specific technical question here, without the big picture info?

dusty wigeon
undone coral
#

not for you

upbeat garden
#

Ok. Thank you anyway.

orchid marsh
#

Example: attempting to share the non thread safe data over a thread isn't going to fly - synchronous issues.

upbeat garden
#

Oh - good point. No - this is in a single threaded context.

undone coral
#

that will help you the most

#

everything is unsafe there

#

you can modify all the code

#

to do everything you need to do

upbeat garden
#

That’s an entirely different engine.

undone coral
#

that is what it sounds like you need

orchid marsh
#

Well playing guessing games isn't fun. Good luck. UnityChanThumbsUp

undone coral
#

"Not Doing Anything"

upbeat garden
#

Btw, do you know if Unity has commented on this issue anywhere?

#

@undone coral 😂

undone coral
#

a Unity.Object belongs to a category of smart pointers

#

it doesn't do what you think it does

iron torrent
# dusty wigeon I really doubt the issue is Cinemachine in itself, but I do not understand why i...

Well it also works in a non URP project as well, and right now there is no other work around. The model for the background can't be duplicated in this case as it is one solid model. The only solution is to remove Cinemachine altogether, then I lose all the benefits it brings that I would need to code myself.

If there is another solution I am all ears. That provides smooth movement.

Which also reminds me, the Brain can have the Mode set to Fixed Update and the Blend to FixedUpdate, but the player movement is Janky as shit.

orchid marsh
dusty wigeon
iron torrent
dusty wigeon
#

The gap is only when your player is moving ?

iron torrent
#

yes

undone coral
#

there are no smart pointer converters either for C# like there are in C++

upbeat garden
#

That is useful information! Ty.

undone coral
#

good luck on your metaverse thing

#

i hope your people are paying you

upbeat garden
#

Oh, It’s not a meta verse thing

#

I’m not sure that’s going to go anywhere for at least a while

undone coral
#

it's an industrial thing, with 0 users? 🙂

#

i'm just teasing

dusty wigeon
# iron torrent yes

I really do not know. Personally, I would not use Cinemachine for SideScroller. You do not gain much.

undone coral
#

listen dude, you wanna thrive at this too. you gotta figure out how to say what the thing is

#

right now it sounds like you are trying to do something... really stupid

#

like profoundly phenomenally stupid

#

it sounds like you need to use Unreal

#

because that's where people's stupid ideas thrive

#

you can change all the code there

#

do whatever you need

#

and it's a good way to never ship

#

maybe you're incentivized to never ship. hardly any unreal things ship

#

they're janky and bad and support all sorts of bad ideas

#

i gave you the benefit of the doubt

iron torrent
upbeat garden
#

I’m sure it does. I get that. But in my experience, a professional coder doesn’t need to have every detail in order to answer a technical question. It’s professional to not assume the people around you are idiots, unless they are doing something that affects you. And even then, it’s professional to not automatically assume people are idiots.

dusty wigeon
upbeat garden
#

But there’s no risk for you to assume those things here, so I get why you’re doing it

iron torrent
#

There are times where I am going to use it to blend to another Camera, as well as various other things that are far, far, easier to do with Cinemachine

undone coral
iron torrent
undone coral
#

i don't think you're stupid

#

i'm just saying you should say what it is

#

there is nothing sensitive about it

#

legal this, legal that

#

trust me. there's nothing sensitive about what you are trying to do

dusty wigeon
undone coral
#

but yeah, seriously, look at Unreal

#

i think whatever it is you are trying to do, it would make sense to do there

iron torrent
undone coral
#

@upbeat garden like your people probably want that jank

dusty wigeon
undone coral
upbeat garden
#

I don’t believe it will be useful to continue this conversation right now.

iron torrent
undone coral
upbeat garden
#

Thank you again

obsidian glade
#

for what it's worth - if you scroll up and look at the first two words in reply to your question, it was answered immediately I think

undone coral
upbeat garden
#

Sorry if I missed it

undone coral
#

it sounds like there's a cool game mechanic lurking in there

#

i was hoping to support that but it's too confused

upbeat garden
#

Sorry, @undone coral was that last message to me?

iron torrent
undone coral
#

anyway i am done

long ivy
hybrid belfry
#

Hi, how can I get access to the class of which my CustomEditor is a type of? Here, it's GridController

undone coral
upbeat garden
#

Really appreciate it. Makes sense. That’s what I was looking for. Won’t do it.

undone coral
#

it just is a confused and nonsensical ask

upbeat garden
#

If you know exactly when it will crash, then why didn’t you say it?

undone coral
upbeat garden
#

Why? Are you with UT?

hybrid belfry
long ivy
#

it'll crash if the object gets GC'd and you try to use it. Otherwise no different from passing pointers to managed stuff into native land as long as you're just holding it and not trying to do something tricky

#

you just need to make sure it doesn't become invalid on you, hence the use of pinning/GCHandle

upbeat garden
#

That’s what I suspected

#

That follows normal GC logic. I wasn’t sure if Unity was doing some more hands-on, fancy mem management with GO data.

dusty wigeon
long ivy
#

it's possible they are moving the underlying data around, but your pointer would be to the managed MonoBehaviour and not the C++ end

dusty wigeon
#

There is a part of the memory that is native, while an other is managed.

#

Unity will free the native part and invalidate the other.

upbeat garden
#

Roger that. Thanks for that info! It’s difficult to find simple details about this stuff online. Especially since what I was asking about is very inadvisable. 😂

#

Really appreciate that knowledge

vernal canyon
#

I'm going nuts 🥜
I'm trying to do something so simple. I'm trying to have a "frosted background" look for behind my popups.
My setup is as followed right now:
I have a camera that renders all my UI (excluding my popup)
I have a copy of my main camera only this time it renders to a texture instead
I have a canvas set to screenspace camera (with my main UI camera linked)
I have a "blur popup" canvas with screenspace camera (with my frosted camera linked). In side this canvas is the popup and a rawimage with my RT in the backgound

With this setup the result is I simply don't see the frosted canvas at all and the RT displays the content of my frosted canvas instead of the main UI

But this isn't working at all for some reason and I've tried every combination of depth, sorting layer and settings I can think of.

upbeat garden
#

I don’t know if you folks get a lot of new coders in here asking dangerous questions - I bet my question sounded like that. I get it. But there was a reasonable reason over here for at least investigating this…juuust enough to double check that it was stupid. :p Thank you to those of you who took the time to just share what you know on the subject.

dusty wigeon
#

To be honest, whatever is the idea. If you are looking for optimization of this level, you are not using the correct engine as Unity as a High Overhead.

upbeat garden
#

You’re probably right. I come from custom C++ ECS engines, then Unreal, then Unity. When they announced DOTS, I was very excited, and poured years into it. But recently, I’ve had to accept that DOTS won’t have anything close to feature parity with the rest of Unity for - maybe - 5+ more years. At least. But with Burst and Jobs still available in MonoBehavior land, I’m interested in finding ways to take advantage of them if I can. But…after so many years of valuing performance over convenience, I’m done letting the perfect be the enemy of the good.

#

But overoptimizing is a hard habit to break. :p At least inside one’s head.

upbeat garden
#

Btw, now that he’s gone, what’s up with that doctorpangloss guy? Is he/she always like that?

dusty wigeon
#

We do not talk about individual. This is for support, not bitching people.

upbeat garden
#

Roger that! You’re absolutely right. My apologies.

alpine sinew
#

--redacted--

#

Since you're saying that you can't "legally talk about it" and that you're being so aloof, and that this potential application (pointers in unmanaged structs) is a potential security risk, I would assume that you are doing something malicious within your code. So I won't be of any further help on this particular issue, unless you can explain your specific use-case here.

upbeat garden
#

I absolutely will not be doing this. And thank you for writing back.

#

I’ve been working too long in unmanaged land. Losing track of basic c# knowledge

long ivy
#

Unity's GC doesn't do compaction afaik, and if it did pinning it would prevent it from being moved. Is that an AI answer?

upbeat path
alpine sinew
#

There, I cited my sources 🙂

upbeat path
#

And that is why you should not use 'AI 'and then quote them, because they usually get the answer wrong

upbeat garden
#

Hmm, if Unity’s GC doesn’t do compaction, then would it wrong to think that a pointer to non-pinned data would only be a crash risk if the GO was destroyed?

alpine sinew
#

@upbeat path if you have a better answer, let's hear it -- but it made sense to me so i posted it. If you disagree with the source, then why?

upbeat garden
#

It sounds like it still a terrible idea for other reasons (like the way Unity handles Destroying Objects)

upbeat path
#

There is no such thing as 'Unity's GC'

upbeat garden
#

I understand that. I was just using the language form the comment above

alpine sinew
#

@upbeat path how so? I mean, without splitting hairs -- where's the GC?

upbeat path
#

GC is a function of C# .Net nothing to do with Unity

alpine sinew
#

Okay so, terminology aside -- Unity's GC is the same GC as C#

upbeat garden
#

Yeah - although it’s always possible they could modify it somehow

#

Though I have no evidence that they have

fresh salmon
#

Quote from the #📖┃code-of-conduct, btw

Do not [...] Ask or answer questions using unverified AI-generated responses.

upbeat path
#

this is software, exact, precise usage of terminology is of the utmost importance

upbeat garden
#

Anyway, is it true that there’s no GC compaction happening with Unity?

upbeat path
alpine sinew
#

If so, I'll correct my post.

fresh salmon
#

Added an ellipsis because of the 15 rules before that one

alpine sinew
upbeat path
upbeat garden
#

Ah - good point.

glossy harness
#

Hey guys, I have a small to medium project that I'm trying to convert to unity's new DOTS packages, Should I start with a new project and port the code over, or is it possible to convert my game objects to entitites somehow?

upbeat path
#

my advice, new project and port, slowly

glossy harness
#

Its not too large of a project so I should be able to do it in a day or two, thanks 🙂

upbeat path
#

test, test and test again as you go along

upbeat garden
#

Even for a small project, the mindset for DOTS is so different that it’s a good idea to at least start a new, Parallel project.

ionic quartz
#

Does anyone have a recommendation for a grid-based pathfinding algorithm for groups of fish going from point A to point B in a large group (but not overlapping eachother)?

dusk bloom
#

Well It took a while, but it turns out it had NOTHING to do with the if statement for some really odd reason. I was tinkering around with it for a long time, and I finally found the issue.
When I was moving the gameObject, to move it backwards I would just do the reverse of moving forwards to the next transform, simple enough. The problem stemmed from the fact that it isn't exactly a perfect line when you go backwards, Unity kinda guestimates with floats, and thats okay. The problem was that it was doing this per frame in the update function, and it was guestimating way too much and wouldn't be close enough to the transforms for the if statement to trigger.

Man that took a while, thank you for trying to help though!

sly grove
#

Do you have a specific code issue or are you looking for someone to design an entire set of systems for you

#

All of that stuff is going to take weeks+ to implement

#

It's not really an advanced problem

#

it's a bunch of small problems

#

which you should tackle one at a time

patent bear
dusk bloom
#

Yep

#

I think I've learned my lesson from that haha

kindred remnant
undone coral
haughty shell
#

Is there is a way to add gui elements to the list element inside a component?
I have a component (Weapon Controller on the screenshot) with custom inspector. It has button and some logic to create instances inside a list from editor.
And now I want the same functionality inside a list element.
Basically I need to create a button inside this Element 0 object.
I can't add it the same way because I added custom gui by working with "target" inside "OnInspectorGUI()" function.
Example of what I'm trying to do.

   public class WeaponBehaviourInspector : Editor
    {
        public override void OnInspectorGUI()
        {
            var controller = target as WeaponBehaviour; // can't cast non-Monobehaviour to target
            ... 
        }
    {

Is there a way to add custom gui to this object inside a list inside a component or I should try another approach?

fading sable
#

question: what is the standard method for making a 3d flying AI enemy? Specifically one that can fly over gaps and can seamlessly ascend/descend while chasing the player?

I tried Nav Mesh, though I don't know if I did it right. The enemy only ascends when it reaches a wall and will either just snap itself to the wall's height, or remain at the same height and just be blocked from progressing

leaden sandal
#

@midnight violet I went back to the old system of using render textures to render it overtop of the UI. I got the cameras distance from the canvas by frustum calculations so it repositions to work with all aspect ratios.

hushed fable
#

You can do 2D navigation + height type of stuff pretty easily, but other than that it's still a 2D navigation solution

fading sable
hushed fable
#

What kind of space are you trying to navigate while flying? Do you have obstacles in the air?

fading sable
#

various 3d environments, from enclosed hallways to more open fields - and likely various props either dangling from the ceiling or protruding from the floor (ex: lights and pillars)

regal olive
#

how would i create a spaceship script, inspired by No Man's Sky. Where when I press and hold on the space button. The Spaceship Will float 5 units into the air from wherever it was landed. then Using W will throttle up, but not using a get axis. And using A and D will tilt the spaceship while turning it.

regal olive
#

Are Raycasts inconsistent in general? I'm trying to implement a custom edge grab/hang/climb solution using root motion etc, but the character.... I can't get him to grab the ledge in a consistent position, particularly on the Y axis, even though I hard-code it to the ledge's position (+/- a Vector3 position offset to avoid clipping into the edge). For reference I'm making a SSB game. It's like he grabs the ledge when/wherever he wants. It's driving me crazy...

analog bane
#

Maybe try a boxcast?

#

Raycasts are pretty consistent though

#

It could also be related to how you're going about it. Like maybe it's not firing when you think it is?

regal olive
#

I'm using a Raycast which fires every frame via Update() with my other collision detection stuff (it's a custom physics solution based entirely on Raycasting). I even tried switching to FixedUpdate which doesn't change much. I even considered using delegates/events but idek the first thing about how to set it up to fire properly.

I have a preset transform.position, plus different PosOffsets for different characters, but I can't get any of the characters to grab the same, pixel-perfect Y position consistently.

hushed fable
#

Don't crosspost.

regal olive
#

Phew, I thought that was directed at me at first lol

analog bane
regal olive
#

I never understood the difference between World and Local, if that's what you mean.

Local brings my character back to (0,0,0).

analog bane
#

For example, let's say the ledge is on the right side of a platform. If you then pick a point on the player, e.g. their head, you can get the vector from their head to the ledge

#

Then you can check if they are to the bottom right of the ledge and within X distance of it

#

(you might have additional criteria though)

regal olive
#

What I want to do is when my character is anywhere within the vicinity of the edge when airborne, just grab it and stick to the same position. Because I have Edge getup options, and they use Root Motion, and understandably, I can't have times where he clears the ledge, others he's too high/low)

hushed fable
analog bane
regal olive
#

I'm gonna try your idea of a BoxCast. IF the power can stop being so spotty for five damn minutes. Bloody endless crap weather :/

#

@analog bane BTW thanks, sorry for not saying

regal olive
#

And.... nope. Physics.BoxCast doesn't work. I can now grab the cliff from anywhere as long as I'm airborne...

analog bane
#

Then I think something is going on with the implementation. Can you share what you have?

midnight violet
leaden sandal
hollow prairie
#

is there anyway to save a prefab between gameplay (like as json format or otherwise?)

in my game i give the option to create a custom character, created by instantiating objects parented to the player base model during runtime, a reference of which is saved and used as the player model for the game

can i save this player-created gameobject between plays and load it somehow?

compact ingot
obsidian glade
plush hare
#

I'm looking to implement some sort of floating origin.

Suppose I have a giant map, separated in 5km grids. Exactly 5km so no fractional part on the floats dealing with the position.

Does it work to just constantly re-parent objects to the center of these grids once they cross the threshold?

#

Or how is this usually done?

compact ingot
# plush hare Or how is this usually done?

You need to move the entire world (tile) to the world origin. Parenting doesn’t help. All transforms are calculated in world space. It also doesn’t matter if your tiles are exactly 5000 units. Practically no value can be stored accurately as a float.

crystal locust
#

Context: I want to combine multiple meshes into 1 mesh using Mesh.CombineMeshes(). Each mesh is a part of a bigger mesh that I want to combine into 1 big mesh. Armature will also be combined, but separately

Issue: Mesh.CombineMeshes() removes 114 vertices, both when import setting Weld Vertices on each mesh part is set to true and false. Is this odd behaviour from Mesh.CombineMeshes and should I use a different approach or is this a bug?

novel nacelle
#

is anyone here familiar with Zenject?

fierce kayak
#

hey guys how do you make a button not be able to be activated when space bar is pushed

#

because i have a simple pause menu set up where to activate the pause function you can either click f or click the pause button

#

but if i activate the pause menu by clicking the button, and then i click f to unpause, the pause button is still somewhat "selected" even after i've unpaused, leading to the spacebar ingame to keep activating the pause function as it clicks the pause button

#

and i can see this with the fading feature where you hover over a button and it goes a bit darker

#

if i pause using the pause button, the button goes and stays a bit grey, and then when i unpause using something that doesn't require a mouseclick (clicking f), and then i go back ingame, the pause button is still grey.

fierce kayak
#

i need it to not be interactable just to spacebar

#

wait never mind dude i fixed it

#

i set navigation to none

regal olive
fierce kayak
#

hey guys how would i make a code that quickly increases and decreases the size of a text? because i want my player score at the top of the screen to quickly bounce in size whenever the score is increased but how would i code it? i can't just do
text.fontSize += 4
text.fontSize += -4 because that won't be a smooth movement

devout coyote
fluid totem
#

I would like to ask how can I enable a gameobject when my mouse is onto the object. This is a UI in my game and I want the outline show out when player mouse move to it.

undone coral
undone coral
crystal locust
undone coral
#

why do they need to be mesh combined

crystal locust
#

I fixed the issue of the different vertices by removing Mesh Optimization

undone coral
#

okay

crystal locust
#

But the bone weights are probably set incorrectly

#

So I am still getting an exploded mesh as a result

#

The bones are correct and the mesh is correct

undone coral
#

i'm not sure why you need these combined

#

i don't think you can use meshcombine to correctly combine skinned meshes and get a valid skinned mesh, and expect everything to just work. there are a lot of considerations

#

this is more involved than you imagine

crystal locust
#

Thank you for explaining that, but that does not help me. As I said, the mesh itself is correct. When reviewing the mesh in the mesh field on a SkinnedMeshRenderer I get the correct result, but in the scene it is messed up by, what I assume to be, incorrect bone weight assignment.

topaz imp
topaz imp
dusty wigeon
#

Then I do not know any documentation. Just beware that you are going on a long journey.

topaz imp
sly shore
#

Hello, I'm working on a skill tree system and i'm completely stuck... The tree consists of multiple nodes with a Skill Script attached to it and each node can have multiple connected nodes (picture 1). Every connected node is also stored in a list in the skill script.

The activation for a node works fine, I just call this:

public void ActivateSkill()
    {
        if (!isActive)
        {
            if (isUnlocked)
            {
                isActive = true;
                foreach (var connection in nodeConnections)
                {
                    connection.activeConnections++;
                }
            }
            UnlockConnections();
        }
    }

I increase the activeConnections for every connected node to keep track to how many active nodes the skill is attached.

Now what keeps my brain melting is the deactivation... I want to be able to deactivate a node but only if there is no active node ahead of the deactivated node so there wont be gaps in the tree. I tried so many things but i just don't get the logic right... Is this even possible to track with the information I have?

glossy harness
#

Hey guys, I'm upgrading an existing project to use Unity DOTS. Currently I am using the unity.entities, unity.entities.graphics, and unity.physics packages

I created a sub scene which I names MainSubscene and added a 3D cube gameobject to it. This 3D cube has components RigidBody and a script called PlayerMovementController added to it. However when I click play nothing happens. I would expect the rigidbody to make the player fall at least (the player is hovering in the air)

(Is Kinematic is not checked and Use Gravity is checked) I feel as if my subscene isnt running, any ideas?

devout coyote
#

Don't you have access to the target node in whatever datatype your connection is from?

#

Usually they are structered like this

public class Edge {
  Node Source;
  Node Target;
}

With this you can then disable deactivations of a node like:

public bool CanDeactivate => !this.ChildrenConnections.Any(x => x.IsActive);
#

I also don't quite get why you need to keep track of the number of connections

#

If you already track the active number of nodes

#

the activation of a node can be checked by running

public bool CanActivate => !IsActive && this.ParentConnections.Any(x=> x.IsActive);
sly shore
#

I have only access to the node itself and the connection nodes directly attached to it. So I don't know how many connections the connected nodes have.

devout coyote
#

Thats fine right?

#

My examples only use parents or children

#

And you can derive whether or not a neighbouring node (if you want to insist on having a single array) is a child or a neighbour by checking if the current node is a target or a source of the connection

#

I am assuming your skill tree is directional by the way

sly shore
#

the path could go like the red one or the green one

devout coyote
#

Aha, so its undirectional!

sly shore
#

ye so I can't just decide which node is a parent and which node is a child right?

devout coyote
#

Nope, there's no relation between the two

#

I can't think of a smart method to do it right now, but what I know can work

#

Is that you traverse the entire graph, and imagine that the node has been removed

#

If the number of nodes reachable is -1 the graph size that was prebvioulsy accesable

#

you know that you didnt create two disjoint sets of nodes

sly shore
#

that's why i was storing the activeConnections.. So I could check if a connection from the next connection has any active nodes so that I know that it's connected to anther node but writing that alone is confusing me again 😄

sly shore
devout coyote
#

This is all the information I was going to give to you -> you are looking if all of the nodes still form a connected component after removing that one node

#

If you still need help later on, be sure to post another thing

sly shore
#

Thank you! I will give it a shot and come back to you guys

dusty wigeon
foggy elk
#

error CS0246: The type or namespace name 'MongoDB' could not be found (are you missing a using directive or an assembly reference?)

Im getting this error after installing the MongoDB packages through VisualStudio. What beats me, is that VS dosent find any errors, but Unity refuses to compile anything..

#

is this related to something called "Burst" that gets "not responsive"?

sly grove
glossy harness
#

Use the unity package manager

sly grove
#

Making Unity work with . NET standards and nuget etc are an eventual goal for Unity but not there yet

glossy harness
#

Hey guys, quick question when using unity ECS unity.entities and unity.entitites.graphics is it required to use URP?

glossy harness
#

thats not a channel I can type in

sly grove
undone coral
foggy elk
#

could be. This isnt the first time Ive used mongoDB though, and last time I feel certain I never installed anything through the unity package manager, and that worked.

#

installed "realm sdk" now though, looks like it might be a bit more flexible in use

undone coral
# sly shore Hello, I'm working on a skill tree system and i'm completely stuck... The tree c...

are you saying

  • you are trying to make a UI
  • that lets players click on circles arrange the way you show
  • these circles are representing some kind of skill in your game
  • the picture you drew isn't a tree, but you said tree
  • a skill can only be activated if it is adjacent to another skill.
  • a skill can only be deactivated if, as another user said, you do not create two disjointed groups of adjacent skills. that doesn't deal with the issue you are showing with a connected group of skills (where a skill can reach itself by visiting other skills exactly once)
  1. assign an activate time "T" whenever you activate a skill
  2. you can only deactivate a skill if
  • all of the other active skills it is adjacent to have a lower activation time T_x than T, OR
  • a depth first search of the activated skill reaches itself
sly shore
# undone coral are you saying - you are trying to make a UI - that lets players click on circ...

What I am trying to achieve is a undirected skill tree, like in PoE or Wolcen (nots as big of course but the same functionality). I am completely self taught so there might be stuff that I've never heard off.. Like graphs and dfs for example 😄 But now that I know this is the proper way to go im gonna dig into that. I'll just gonna add a reset button for the whole tree for now till i figured everything out ig. Thanks for all the advice!

obsidian glade
#

in PoE it's actually not a tree at all, even though it's often called that

#

(might help your search of various algorithms if that distinction is clear from the start)

sly shore
#

yes that's what I'm trying to achieve! I just wasn't aware of graphs because whether it's directed or not its always called skill tree everywhere 😄 But thanks for clarifying!

plush hare
# topaz imp does anyone know a documentation for car physics by any chance? something along ...

Cars and suspension are actually extremely simple on the surface.

Essentially, you never have an actual solid collider on your wheels, despite the name "wheel collider".
At each wheel well, you'll simply raycast downwards. The length of the raycast is the length of your imaginary spring.
From here, we can determine how much the spring is "compressed" by the distance that it actually hit.

#

Next, we need to add force upwards on each wheel well, proportional to the amount the spring is compressed. Highly compressed spring? More force upwards. Less compressed spring? Less force upwards.

#

next you need to add a counter-force to your spring, proportional to the speed of the spring (difference in compression from last simulation tick and current simulation tick), otherwise your car will bounce up and down infinitely like one of those 80's low riders. All we're doing here is adding friction to our imaginary spring to slow it down.

#

after that, you should have a basic suspension working.

#

You'll also notice that your car is sliding around like it's on ice, so you'll need to implement a basic sideways friction.
Basically find the current sideways velocity at the wheel, and apply a counter-force proportional to it. If you do this right, when your front wheels turn, your car should also turn. This also allows sliding/drifting if the car is going fast enough. Hint: After getting the velocity at each wheel, you should temporarily convert it to local space, cancel out everything except the sideways component, then convert back to world space.

#

The "wheel" in this sense is just an empty gameobject positioned at the center of the wheel well. Your raycast can be shot from it. I'm sure you're smart enough to figure out how to position the visual wheel mesh based on the raycast.

echo owl
#

Hi everyone im pretty experienced but i don't know everything lol, ide like some help to go in a direction if possible, i would like to spear cast and cut into any object and only remove what's within the spear cast and not the actual object its self i think i need to do something with Voxel Generation
i basically want to program a cookie cutter script for mining rocks, like space engineers

#

just not sure wear i should start, what things should i look into ?

minor cloud
#

Then move to Marching Cubes

raw lily
#

I have a SerializedField that's null when called in Build but not null in Editor, what's wrong?

echo owl
#

thank you

plush hare
#

@echo owlRaycast itself returns the triangle you hit

#

which you can then access directly on the mesh

#

not sure about sphere casting or anything

long ivy
raw lily
#

calling Debug.Log on it prints Null

#

(only in build, it prints gameobject.. in play mode)

#

no operator no nothing

solemn urchin
#

are there any must watch videos or must read articles about URP / SRP been wading through the docs and finding it difficult to get deferred rendering working

#

wait theres probs a better place to ask this

austere jewel
solemn urchin
#

my bad ^_^

raw lily
undone coral
dusty wigeon
topaz imp
spring gorge
#

dear senior unity, are you guys use DOTS much in your project?

tiny pewter
#

i want to use dots in my pathfinding, but no reference type is allowed in job system....

raw lily
fresh salmon
raw lily
#

Oh wait sorry, had the same issue with GameObject

#

But also having it with GetComponentInChildren right now

#

The issue is very similar, null when it should not be (only in build, not playmode), and in this case I can't just Resource.Load as a bad workaround

#

(and they were all contained in the scene, so nothing external)

#

that's one of the reasons I don't like Resource.Load as a workaround

raw lily
#

Does anyone have a suggestion on how I should go about fixing this?

#

I spent hours on this and I'm running out of things to try out

#

Printing the SerializedField will return null in Build but GameObject in Play Mode

#

Same thing with GetComponent

dusty wigeon
#

Usually, issue of the type of "This Object is null only in build" comes from missing asset in the build. I would consider using AssetBundle/Addressable to have a better control of what is or not included. From there, you have multiple tool available to analyze the issue.

regal olive
#

I have a takeoff keybind and It is not working

#

can someone review my code

raw lily
#

I look into Adressables and see, but in that case it's the main ui

#

So it would make sense for it to be already there

regal olive
#

oh and I have no errors in the console either

fresh salmon
regal olive
#

there

#

if the spaceship is on the ground

#

i can press F

#

to takeoff

fresh salmon
#

Unless you have extreme timing it's never gonna happen

regal olive
#

ooooh

#

i think i know what u mean

#

how do i fix it

fresh salmon
#

This runs once, then you exit the while loop because hasLanded is true

#

touchedGround I mean

#

Handle it in Update

#

Or any method, as long as it runs each frame

kindred remnant
regal olive
#

alr

kindred remnant
#

think of a way to not do that, and you have your answer

regal olive
#

lemme try something

#

should i take it out of the land courotine?

kindred remnant
#

maybe, try it then ask

fresh salmon
#

Yes

regal olive
#

what is a basic bool I cna define for isGrounded

kindred remnant
fresh salmon
#

You already have it?

regal olive
#

i dont

fresh salmon
#

touchedGround

regal olive
#

but is that a one time thing?

fresh salmon
#

Not if it's declared in the class, checked in Update, and set to false on takeoff, for example

#

The landing coroutine sets it once, but its value doesn't change until you do so elsewhere

kindred remnant
fresh salmon
#

You also have a bool landed; declared in the class, that's unused. You could use that

regal olive
#

wait

#

im having trouble

kindred remnant
#

or at the very least a thread

regal olive
#

the touchedGround is defined in the courutine

#

how do i take it out of the corutine

#

wait

#

wait

#

wait

fresh salmon
regal olive
#

hmmmm

#

fishyfred

#

can u hlep?

raw lily
#

Okay, so some new progress on my issue, it seems to be way bigger. I tried creating a dumb script, it will only print in Play Mode, never in build.

#

It's at the root of the project, with a gameobject assigned (created an empty one also at the root of the scene), which can also be verified by the fact it works in Play Mode.

Also note there are no errors, the rest of the game is playable.

dusty wigeon
# raw lily Okay, so some new progress on my issue, it seems to be way bigger. I tried creat...

You have something wrong with your setup and we cant help you because we do not have access to your project. The only thing I can say, is that you should always be able to have reference by [SerializeField]. If something is there is the Editor and not in Build, it is most likely an issue with how the asset are being added to your build.

As much as I would like to help you, there is nothing I can do there. You need to look into it yourself and find out why your asset are not included in build. The best way is to ensure that it works is to make sure that you are correctly using Addressable (If you use it).

raw lily
#

How do you fix build issues?

dusty wigeon
#

This is what I'm saying from the start. Look why the asset is not included in build.

raw lily
#

So it's possible something in the scene is not included in the build?

#

That doesn't sound like that's how it's intended to work but I could be wrong.

dusty wigeon
#

It should not. But who knows. You may have a strange way to bundle your asset.

raw lily
#

Where am I bundling assets?

#

Or how does one bundle assets, except adressable and Resource.Load?

dusty wigeon
#

I assure you that it works out of the box. It is something you have done wrongly. (At worst, it could be a new Version issue, which would be unlikely)

dusty wigeon
raw lily
#

I've done things this way for about 1 year on this project, and code that is EXACTLY the same, only difference it not being new, works.

dusty wigeon
#

Are you sure you are loading your resources correctly ?

raw lily
#

What do you mean?

dusty wigeon
raw lily
#

Only adressable stuff I use, afaik, is localization.

#

Hmm.. I'll read a bit.

umbral trail
#

At edit time, how can I create an instance of a prefab with a link to the original in the scene?

raw lily
#

Shit I think I figured it out, even though in Play Mode I use 0-2-2 as a scene, I think the build is just using an older version. Will try that out but it makes too much sense to not be it.

undone coral
warm dust
#

Hi!
I apologize if this is the incorrect channel for Timeline related questions.

I'm currently pausing my Timeline by using a Signal Emitter that sets the speed to 0.
This "works" but the issue is that I'm getting varied results of when the Timeline pauses.
Though every time, it pauses a bit after the Signal Emitter is reached.

Is there an alternate way of pausing (setting the speed to 0) my Timeline outside of using a Signal Emitter? I'd like to be able to pause my Timeline immediately so it's consistent.

Thanks!

dusty wigeon
#

I believe you cannot pause the Timeline exactly where you want as it is on a separate Thread. I am not 100% sure though.

undone coral
#

programmatically pause a cutscene while the player does something, then when the player is done, resume it?

warm dust
#

Yes

undone coral
#

can't you loop somewhere instead? also, if you already have this working, if you know it's always pausing at around the same time, maybe add a little bit of slack?

#

what is your specific question

undone coral
warm dust
undone coral
#

what does the signal event emitter have to do with it?

warm dust
#

The signal emitter is whats calling the method that pauses the timeline

undone coral
#

this is kind of a general programming question or even beginner. you have to break down the problem into smaller pieces 🙂

warm dust
#

If there's an alternative, I'm not aware of it

undone coral
warm dust
#

Setting the speed to 0 pauses the Timeline in the traditional sense

undone coral
#

the game object that has your timeline should have a playable director component

#

okay

#

but i'm asking why you are not doing it uh

#

you know, the way that i am saying

#

it's okay if it's "i don't know how"

warm dust
#

Sorry, I'm not sure what you're asking me

undone coral
#

okay well

#

do you have a lot of experience programming in C#?

warm dust
#

Yes

undone coral
#

or are you trying to achieve something happening in timeline without any scripts

undone coral
warm dust
#

My signal emitter is calling a method that is on a script. I really appreciate you trying to help but it doesn't seem like you are very familiar with Timeline.

undone coral
#

can you show me that method?

warm dust
#

Sure.

    {
        director.playableGraph.GetRootPlayable(0).SetSpeed(0);
    }```
undone coral
#

okay, so help me understand, why are you not doing director.Pause()

warm dust
#

Because Pause() suspends the timeline at the current time and stops evaluating it. That is why people shy away from it in favor of just setting the speed to 0.

If it gives you peace of mind, using Pause() has the same issue because of exactly what Simferoce mentioned

#

That's why I'm trying to see if anyone uses an alternate method of pausing their Timeline instead of using a Signal Emitter.

undone coral
#

okay... why not set the time to the time you want?

#

you can defer it if it seems ot interact poorly with pausing

#

e.g.

void StopTimeline() {
 StartCoroutine(StopTimelineDeferred(signalEventEmitterTime));
}
IEnumerator StopTimelineDeferred(double exactTime) {
 director.Pause();
 yield return new WaitForEndOfFrame();
 director.time = exactTime;
 // you might have to evaluate the director here, not sure
 director.DeferredEvaluate();
}
#

i'm not sure why it isn't happening exactly when you would expect it to. you might have to manually update your playable directors - i always do

#

because it's easier to wrap my mind around script execution order that way

#

i wouldn't use a coroutine, i would use an async task, but it's the same thing

#

@warm dust maybe this will work. i agree it's very odd that what you are doing is buggy*

#

i wouldn't set the speed to zero in any case

#

that makes the least sense 👀

#

i mean unless it specifically worked around this issue

#

you might be able to skip the waitforendofframe actually

#

you might just have to set the time and call deferred evaluate

#

and before the scene is actually rendered (i.e. within LateUpdate) the director will evaluate as expected

#

@warm dust does that work?

warm dust
#

No, but that's okay I appreciate it. I'll figure something out. 👍

undone coral
#

that exact code did not work?

#

does it go to any time?

#

like if you set the time to 0

#

does it go back to the beginning?

undone coral
dusty wigeon
undone coral
#

unless playables uses Time.deltaTime, i assume for the sake of simplicity it only advances the clock to the timestamp of the frame that was most recently presented to the screen, which is maybe why this exact issue is occuring

#

it is the only other robust option if you don't do the science of Time.deltaTime

#

i.e., the time it "stops" at appears to be slightly ahead of when it was actually called

#

so no consideration is made wrt the time Pause is called

#

so basically what i'm saying is

a frame is presented to the screen at time t
a new frame has started
playabledirector.time is set to t
the user calls pause at time x, which is necessarily ahead of t
playabledirector is now going to compute the graph for time t, even though we are "t + Time.deltaTime" ahead
a frame is presented to the screen at time t + total frame rendering time containing playablegraph contents t
a new frame has started
playabledirector.time is set to t + total frame rendering time
...
playabledirector is NOT going to compute the graph for this new time, because it is paused

@warm dust @dusty wigeon does that make sense?

#

okay based on a visit to the source code, this is indeed what happens when DirectorUpdateMode is set to DSPClock. @warm dust you can try experimenting with GameTime, UnscaledGameTime or Manual instead?

#

the time isn't set to t + total frame rendering time but it is not set to t + Time.deltaTime either, so it will have the same discrepency

#

there are a lot of considerations in the source about time accuracy

#

i think if you are using sound, it might make sense that it is not at the exact time you call pause

echo owl
#

Thank you everyone who directed me to Cube Marching yesterday, created a working proof of concept for my vr astroid game to get started

dusty wigeon
# echo owl Thank you everyone who directed me to Cube Marching yesterday, created a working...

Beware of performance, such feature can be expensive to operate depending on the amount of objects being process. You should make sure that you obtains valid FPS from the hardware you use as well before commiting. The requirement of VR headset can be hard to meet.

That being said, I am sure you can find a solution that could work, but you may have to restrict your usage of this feature.

plush hare
#

I think it's called sweeptest

topaz imp
plush hare
#

@warm whaleYou don't just "setup A star". You implement it into your game. It's just a search algorithm.

#

That doesn't make any sense

#

What part are you stuck on?

#

You should have something that resembles walkable nodes. After you've found a path, it should be as simple as interpolating the NPCs along that path.

regal olive
#

Right, so I did more testing on my Edge grabbing? It works fine, for the most part. The raycast RESULTS are just VERY delayed, and so for varying times. Hence the varying Y axis positions when grabbing an edge.

So I have this code to run when airborne, because I only need edge grab/climb when in the air. I'm running this in FixedUpdate() but I notice no significant change from running it in Update()

    {
        Vector3 rayOrigin = (user.Sign() == 1) ? raycastOrigins.topRight: raycastOrigins.topLeft;
        Debug.DrawRay(rayOrigin, user.Sign() * user.parametersFile._CliffCatchRayLength * Vector3.right, Color.red);
        if (Physics.Raycast(rayOrigin, user.Sign() * Vector3.right, out RaycastHit hit, user.parametersFile._CliffCatchRayLength, cliffMask))
        {
            collisions.onEdge = true;
            user.EdgeGrab(hit.transform);
        }
        else
        {
            collisions.onEdge = false;
        }
        user.animStates.SetBool("Fighter_OnCliff", collisions.onEdge);
    }```

What on bloody Earth? Seems pretty standard to me 🤷‍♂️
sly grove
#

Doing it in Update will change nothing since collider positions only update during the physics simulation step

regal olive
#

But the collider doesn't move. It's totally static. But sometimes it hits, others it won't. And sometimes I get an insane delay between the hit and the action. It's totally weird. All that's supposed to happen is, my character gets "warped" to a position where it looks like his hand is flush on the edge, which can differ for different characters, ad that's it. Why it's so wildly inconsistent, I don't know :/

sly grove
#

And add some logs

regal olive
#

The logs just show up when the (delayed) action happens. But I'll show a snap or 2, hold on

brisk pasture
#

what do you mean by delayed, Raycasts like most things are blocking it returns right away

regal olive
#

Thanks for the replies. Got any idea how HARD it can be to get noticed on this server? D:

Anyway, THIS is what I mean by DELAYED: In this shot, the raycast is INSIDE the collider, but does nothing. Only frames later will he actually grab the "edge", which by then, the character looks like he's grabbing wall instead of the corner. And that Y position varies all the time: he can be on the floor, just inches above it, and even above the edge.

#

Every online solution I've "found" is rigidbody based, which doesn't help. It's a custom solution.

dusty wigeon
regal olive
#

No. I checked my transition times, etc. All checks out. It's setup to be instant.

dusty wigeon
#

If you detect the collision the frame you do and you act accordingly, then it should work.

#

There is no delay in detection.

regal olive
#

It's so weird. I can code a moveset "scripting" interpreter, but this completely eludes me.

But it just doesn't want to detect it right away.

sly grove
dusty wigeon
#

If you do Physics.Raycast(...), it detects right now.

dusty wigeon
#

You can also use SphereCast.

sly grove
#

Spherecast has the same limitation

regal olive
#

It's firing from just outside the character's collider. This isn't trying to collide with itself (the character)

dusty wigeon
#

SphereCast with points*

sly grove
regal olive
#

The collider I have highlighted is the Edge's.

sly grove
#

Well that's your issue

#

It's inside

regal olive
#

Sorry for not clearing it up

brisk pasture
#

yeah and it looks like the raycast starts and ends in the edge collider

#

so will detect nothing

regal olive
#

I even tried to use a Trigger.

#

So I should give it a start offset, in a sense, to fire it from more in the middle?

sly grove
#

What does "use a trigger" mean exactly

regal olive
sly grove
#

That doesn't change anything about the way Raycasts work

regal olive
#

Very odd. I don't mean to criticize, but the way the Docs are written make it too cryptic and hard to understand.

sly grove
#

In fact I assumed it was already a trigger since the character is inside it

brisk pasture
#

its just a matter if where you raycast starts

sly grove
#

There's a specific callout in the docs for this

regal olive
#

..........I wonder if I should start the Raycast from the corner BEHIND the character's head rather than in front.

sly grove
#

You'd probably be better off with an OverlapXXX call than a Raycast here

brisk pasture
#

will be easier to fine tune and configure that too

regal olive
#

I tried overlap but it lacks much of the precision I need from a raycast (layerMask, etc)

dusty wigeon
#

That is what I was thinking lol.

sly grove
#

If you need contact info that's maybe different

regal olive
#

I was think Overlap Capsule for things like attack hitboxes later, but for this? 🤔

warm stump
brisk pasture
#

capsule also has layer masks

sly grove
dusty wigeon
#

You can start by using an OverlapSphere than go for Raycast if you detect a collision.

brisk pasture
#

Notes: Raycasts will not detect Colliders for which the Raycast origin is inside the Collider.@warm stump

regal olive
#

That's interesting, I had no idea...

#

Even the other video tuts I watched didn't make this clear.

brisk pasture
#

thats a quote directly from the docs

regal olive
#

I don't often read the docs. Most of the time they don't explain stuff in a way I understand. I'm mostly a self-taught Unity dev. I have very little programming background, mainly from Java so it helped with C#, but that's it.

brisk pasture
#

its a habit to get into. if you hit issues its often a good use a time reading up on the building blocks of what you are using

regal olive
#

For other stuff it's mainly very barebones explanations, so yeah. I turn to the Docs first usually, and almost always leave with more questions than answers.

arctic lake
#

Unity's voice recognition randomly stopped working for some reason and I have no idea why

#

I gave it permission, and it definitely worked before and I didn't change any code with it

regal olive
#

Aha! Changed by Raycast origin to the corner of the collider BEHIND my character rather than right in front of his face. WAY BETTER, it actually hits every time for starters!~ Thanks!!! ❤️

Now just gotta mess with my Vector3 position offsets!

wheat quarry
#

Can anyone tell me if they see anything wrong with this code? It's just meant to change the position / rotation of each of the children in the "terrain" prefab, but both the position and rotation seem to be refusing to change.

I debugged the newTransform values and they seem fine, but it doesn't seem to be actually applying to the object.

I'm new to programming so sorry in advance.

austere jewel
wheat quarry
austere jewel
#

Quaternions are not Euler angles.
What this means:

  • They are not a 3-axis system, they should not be considered rotations about x, y, z.
  • Their individual components are not to be used.
    x, y, z, and w are for advanced use cases only.
    You want localEulerAngles or eulerAngles, not rotation.
wheat quarry
#

Thanks I'll check that out, but even if I comment out the rotation part

#

The transform is still not working

#

It's like childTransform isn't being changed

#

But newTransform has the correct x, y and z values

austere jewel
#

Have you done any debugging? What are the child transforms? Why would you need to change the positions of children instead of just rotating the parent?

wheat quarry
#

The child transforms are basically all of the objects in the "terrain" prefab

#

I've tried debugging for the last 30 minutes and can't figure it out, all of the values match up but it's like the transform isn't being applied to the child transforms

#

It's not actually taking effect

#

But the debugs show the correct transform values

#

And it was working perfectly fine earlier, it just stopped after a small code change which was completely unrelated to this

austere jewel
wheat quarry
eternal musk
#

Hey all. I hope this is the appropriate channel to ask this question. I find it rather complicated considering that I'm not the best at math. I think I have a general idea of how this could be done but don't know how to put it down in code.

Essentially, I am trying to snap objects to a 1x1 grid on a plane of ANY angle.
The picture basically shows the problem I am working with here. I hate the overlap here. I want them to snap to a grid no matter what angle plane the object lands on.

    private void CreateGridSpace(Collision collision)
    {
        Vector3 pos = collision.contacts[0].point;
        Vector3 normal = collision.contacts[0].normal;

        // This is just some things I think might be helpful which I found while experimenting. Not sure if I will use them or not. Figured I'd share just in case.
        Vector3 tangent = Vector3.Cross(Vector3.up, normal).normalized;
        Vector3 bitangent = Vector3.Cross(normal, tangent).normalized;

        Debug.DrawRay(pos , normal, Color.cyan, 1000.0f);
        Debug.DrawRay(pos , tangent, Color.blue, 1000.0f);
        Debug.DrawRay(pos , bitangent, Color.red, 1000.0f);
        
        // This is the code that actually puts objects on the surface, rotated accordinglty
        Vector3 upDir = Vector3.Cross(normal, Vector3.up);
        GameObject newGridObject = Instantiate(_gridObject, pos , Quaternion.identity);
        newGridObject.transform.rotation = Quaternion.LookRotation(-upDir, normal);
    }```
#

I appreciate any help

wheat quarry
#

@austere jewel Fixed everything, ended up being a logic problem and me not using my brain. Was in front of me the whole time. thanks for the help though 🙂

#

from this

#

to that lol

patent bear
eternal musk
# patent bear Do you have the logic to snap to a 1x1 grid positioned at the origin? If so, to ...

I've actually been tinkering with a slightly hacky but good workaround. I am creating a primitive plane on the position which becomes the parent of the instantiated object, and then the only thing that has to be rounded is the X and Z, and then the plane is aligned with the surface.

I believe I'm off though, It's not quite working as expected on surfaces other than the ground

        GameObject newGridObject = Instantiate(_gridObject, pos, Quaternion.identity);
        GameObject plane = GameObject.CreatePrimitive(PrimitiveType.Plane);
        plane.GetComponent<MeshCollider>().enabled = false;

        //plane.SetActive(false);
        plane.transform.position = pos;
        
        newGridObject.transform.SetParent(plane.transform, false);
        newGridObject.transform.localPosition = new Vector3(Mathf.RoundToInt(pos.x) - pos.x, 0.0f, Mathf.RoundToInt(pos.z) - pos.z);


        plane.transform.rotation = AlignWithSurface(normal);```
#

Since the plane is set to that position then the grid object can't be rounded since its already locally at zero.

gaunt tide
#

im trying to make my axe aim at right stick in the new input system using```
private PlayerInput PlayerInput;
private Vector2 rightStick;
[SerializeField]private Transform Axe;

private void Awake()
{
    PlayerInput = GetComponent<PlayerInput>();
}
private void Update()
{
    rightStick = PlayerInput.actions["RightStick"].ReadValue<Vector2>();
    Vector3 dir = new Vector3(rightStick.x, rightStick.y, 0);

    Vector3 aimdirection = (dir - transform.position).normalized;
    float angle = Mathf.Atan2(aimdirection.x, aimdirection.y) * Mathf.Rad2Deg;
    Axe.eulerAngles = new Vector3(0, 0, angle);
}``` 

but it doesn't work it just aims to at random position any one know how to fix?

dusty wigeon
gaunt tide
#

why not

dusty wigeon
#

Think about it.

gaunt tide
#

i do it like that everytime using the mouse position it works but when using the new input system it doesnt

dusty wigeon
gaunt tide
#

i dont think you know either

dusty wigeon
#

Good try.

#

What are the values that transform.position and dir can take ?

gaunt tide
#

Vector3

alpine sinew
#

Maybe should be posted in #archived-networking idk --
I'm really at a loss here and would appreciate some direction:

Using the Unity Mirror library, I'm trying to synchronize Server --> Client references to custom NetworkBehaviour objects named ConstructableElement. I have a dictionary:

public Dictionary<int, ConstructableElement> elements = new Dictionary<int, ConstructableElement>();

per the documentation, I took the step of making it a readonly SyncDictionary:

public readonly SyncDictionary<int, ConstructableElement> elements = new SyncDictionary<int, ConstructableElement>();

And recognized I would need to make a custom reader/writer. Because my custom object ConstructableElement has non-writable features, I can not make a custom reader/writer. So I decided to store a reference to the ConstructableElement instead, storing the uint of the ConstructableElement.netId:

public readonly SyncDictionary<int, uint> elements = new SyncDictionary<int, uint>();

But then I realized that uint is also not a supported network type, so I will need to write a custom reader/writer for the uint now. I feel like I'm just going in circles.

Am I approaching this wrong? Or am I really needing to write a reader/writer for uint? Am I missing something? Any input is greatly appreciated.

dawn haven
#

Hi, I would like to create an ink system, for that I use this script which adds a texture over the texture of the object I want to paint, the problem is that it removes all the black in the texture and not keep any color except white so i would like to know how to keep colors without using shaders

storm pawn
#

Can someone help me why i get these weird out of bounds indices?
Here is the OnPointerClick Method

       public void OnPointerClick(PointerEventData eventData)
       {
           if (eventData.button == PointerEventData.InputButton.Left)
           {
               int linkIndex = TMP_TextUtilities.FindIntersectingCharacter(dialogueText, Input.mousePosition, null, false);
               Debug.Log($"LinkIndex: {linkIndex}");
               if (linkIndex > -1) //check if we clicked a linked text
               {
                   var linkInfo = dialogueText.textInfo.linkInfo[linkIndex];
                   var linkId = linkInfo.GetLinkID();
                   if (linkId == "continue")
                   {
                       Debug.Log("Pressed Continue");
                   }

               }
           }
       }

and here is the method where i add the link :

        void UpdateUI()
        {
            // Have a Speaker Dictonary with the Color Codes 
            dialogueText.text = dialogueText.text + "<b><color=#FF000088>[" + 
                playerConversant.GetSpeaker() + "]</color></b>\n" + 
                playerConversant.GetText() + "\n<u><link=continue><color=blue>Continue</color></link></u>\n";
            responseDropdown.ClearOptions();
            if (playerConversant.IsChoosing())
            {
                responseDropdown.gameObject.SetActive(true);
                BuildChoiceDropdown();
            }
            else
            {
                if(!playerConversant.HasNext()) { return; }
                playerConversant.Next();
            }

        }
upbeat path
storm pawn
#

Thats an array of the Textmeshpro Links

#

So if i understand correctly every <link> marked element gets added to that

upbeat path
#

so debug.log dialogueText.textInfo.linkInfo.Length

storm pawn
#

ok i try that

#

ok so as i expected the link info has a length of one

#

but why the hell do i get this random index from my pointer?

#

AHH IM SO DUMB. I found it

#

i called FindIntersectingCharacter instead of IntersectingLink

dusty wigeon
storm totem
#

Help me mates. I’ve been trying to use a Void Awake method to get the instance for a script of mine, but it hasn’t been working.

sly grove
#

Your errors have nothing to do with awake, instance, etc.

storm totem
#

IDE?

sly grove
#

just a basic C# syntax problem

sly grove
#

!ide

thorn flintBOT
#
💡 IDE Configuration

If your IDE is not autocompleting code
or underlining errors, please configure it:

Visual Studio (Installed via Unity Hub)
Visual Studio (Installed manually)

VS Code*
JetBrains Rider
Other/None

*VS Code's debugger plugin is unsupported.
We recommend using VS or Rider instead.

sly grove
#

you have obvious, blatant syntax errors that your IDE is not showing you, and you need to configure it so it shows you them

#

otherwise you are going to struggle endlessly with basic issues like this

storm totem
#

Ohhhhhh

#

well damn, my fault og

#

Thanks though, I appreciate it

frosty flame
#

Well, @storm totem maybe would be good to get some, basics of syntax learned. As that was comming right into eye the issue with the brackets

lavish meteor
#

Hi, anyone have an idea how to launch a .jl (Julia) program in the background? I've set up the following https://hastebin.com/share/gonivomeke.csharp and I don't know why it wouldn't work... (If this is the wrong channel please correct me | Reposted because it kind of got lost)

sly grove
#

but if you want to know "why it wouldn't work" you're going to have to explain exactly what you mean by it not working

#

what happens?

lavish meteor
#

So I get the following error NullReferenceException: Object reference not set to an instance of an object JuliaUnitTest.Start () (at Assets/Scripts/JuliaUnitTest.cs:43). I guess the function within my Julia script doesn't even get called. Even if I just return a string without the other calculations, and print outputJson it prints an empty log in unity

sly grove
#

NREs are always the same

#

go to line 43

#

figure out what's null

#

(can't tell you which is line 43 in your example since you cut off the top of the script)

lavish meteor
#

the outputJson is null. I don't get why it is null tho

sly grove
#

Oh this is always going to return null

#

JsonUtility.FromJson<Dictionary<string, object>>(outputJson);

#

JsonUtility doesn't support dictionaries

#

and even if it did it doesn't support naked collections

lavish meteor
#

So it would work if I used just a string?

sly grove
#

define "it" and "work" 😆

#

does print(outputJson); work?

#

What does that print?

lavish meteor
#

It prints nothing. Even if I just return a hardcoded string

sly grove
#

if that prints an empty string then your julia program doesn't print anything to standard output

frosty flame
#

@lavish meteor start with that you place full code first.

#

43 line is empty, no-one know how much lines you have at top, fix your code, so it's more clear what is crasshing with NullReference

#

But basically more or less NullReference exception is if you try to access object method without having any object in there

#

EG:

WhatEvever myVariable;

--> in this process the object was never created and assigned to myVariable;
myVariable.doWhatEver(); // this will cause NullReference exception

lavish meteor
sly grove
#

and it prints things to console

#

that's standard output

#

in C# you print to stdout with Console.WriteLine() for example

#

I have no idea what Julia is or how you write to stdout in julia

lavish meteor
lavish meteor
sly grove
lavish meteor
#

I didn't define which function it should use, just the .jl file... Could that perhaps be the error?

sly grove
#

definitely

#

how would it know what function to run

#

you should really test this in the command line first

#

then bring it to C#

lavish meteor
#

But how would I tell it

sly grove
#

idk

#

that depends on how julia works

#

and I just learned of its existence 5 minutes ago

lavish meteor
sly grove
#

since that's exactly what you're doing

#

when you do Process.Start

forest shoal
#

Hello, I created a deepclone of a UIPanel using "Object.Instantiate" but it seems that some of the ui components inside this panel still points to the old UIPanel

#

how can i reassign them to point to the new panel

#

?

sly grove
#

not objects from the scene

forest shoal
#

yes thats what i did

sly grove
#

then I have no idea what you mean by "it seems that some of the ui components inside this panel still points to the old UIPanel"

#

you'll need to share specific details.

forest shoal
#

it is UIPanel class

sly grove
#

UIPanel is not a built in class

#

that's something you've made custom

forest shoal
#
            customOldUIClone.gameObject.name = customWorldInfoPanelName;```
sly grove
#

customOldWorldInfoPanel.instance indicates it is not a prefab

#

but likely a singleton instance which is in the game already

forest shoal
#

yes

sly grove
#

also your naming conventions are all over the place

forest shoal
#

it is a generic function

sly grove
#

Why are you cloning a singleton? This is all very fishy

forest shoal
#

this is a panel class: UniqueFactoryWorldInfoPanel

#

i am cloning it

sly grove
#

Why

#

Also that's not what you showed in your above example

#

you showed customOldWorldInfoPanel.instance

forest shoal
#

customOldWorldInfoPanel - is a variable

sly grove
#

What kind of variable

#

you need to share a lot more detail here

forest shoal
#

I know but it is a bit game oriented

sly grove
#

Nobody is going to be able to help you without more details

#

and an explanation of what you're actually trying to do

forest shoal
#

the Game is Cities Skylines, i am creating a mod for it, the game has industrial buildings that has panels to them, i am cloning the industrial panel to add my own resources to it

#

so i have a a copied control class and i want to use the original ui with my control class

sly grove
#

That seems like a really bad way to do it

#

Can't you just add more rows as children of their vertical layout group?

forest shoal
#

so i copied the ui panel and changed its name to my new class name and also destroyed the control object of the ui and add my object instead

#

no because the ui depends on transfer reasons and i am using my own reasons and you cant override these reasons and add your own

#

the issue is some of the ui elements in the UI still points to the old ui

#

when i click the close button on the UI, the game searches for the old panel name which does not exist

#

instead of searching for the new panel that is open right now

storm totem
# sly grove VS is your IDE

Sorry to pester you with probably a basic code problem, but I switched my IDE to regular VS instead of VS code and it didn’t change the problem. Could you please explain how exactly could I fix this?

sly grove
storm totem
#

my bad

sly grove
#

indeed

storm totem
#

my asian line eyes really be inhibiting me sometimes -_-

sly grove
dire drum
#

Guys. no idea why I'm getting this behavior while I'm not debugging. I'm getting a classic null exception on a script because the object doesn't exist... but the thing is the game is NOT running, not even in debug. and the only way to get to this part of the code, is to get into "start()" mono class...

#

I have no idea why it does that. Ever happened to anyone?

sly grove
dire drum
#

There is a public variable for this variable, so will unity try to initialize even though it's not running?

#

NullReferenceException: Object reference not set to an instance of an object
GameTypes.Players.Deck..ctor () (at Assets/Scripts/Main/GameTypes/Players/Deck.cs:18)
UnityEditor.GenericMenu:CatchMenu(Object, String[], Int32)

sly grove
dire drum
sly grove
#

if the field is serializable - unity will create an instance of it to serialize

#

calling your constructor

#

hence the error

dire drum
#

oh ok. So I need to account for it even though it's not running

#

got it

valid shale
#

Hi, just wondering if anyone is encountering an issue with HDRP (14.0.7 in Unity 2022.2.14f1 using DX12) randomly throwing null reference errors from inside UnityEngine.Rendering.HighDefinition.HDShadowManager.PrepareGPUShadowDatas? It will either happen not at all, or trigger 15 or so errors, or sit there for a few seconds spitting out 1000+ until something stabilises internally. This is the Unity editor console of the errors that happen in sequence as well as where the error is generated from inside the HDRP package.

#

If I add a null check on m_ShadowRequests[i] before the assert and skip the loop if it's null then the errors don't occur (although I'm sure it's not a functional workaround), however the code obviously gets reset before next run since it's just changing the package cache, so it's not a long-term fix.

#

Should also mention that none of the lights in the scene have shadows enabled

dusty wigeon
brazen hamlet
#
  private void Update()
    {
        chaseTime();
    }

    void ChasingDown()
    {
        isChasingDown = true;
    }

    void chaseTime()
    {
        if (isChasingDown)
        {
            Vector3 directionX = (playerPos.position - transform.position).normalized;
            transform.rotation = Quaternion.LookRotation(directionX);
            transform.position += directionX * chaseSpeed * Time.deltaTime;
        }
        else // Otherwise, move towards the next waypoint
        {
            MoveToNextWaypoint();
        }
    }

    private void MoveToNextWaypoint()
    {
        if (waypoints.Length == 0)
        {
            return;
        }

        Vector3 direction = waypoints[currentWaypointIndex].position - transform.position;
        direction.y = 0f;

    
        if (direction != Vector3.zero)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(direction), rotationSpeed * Time.deltaTime);
        }
    
        transform.position = Vector3.MoveTowards(transform.position, waypoints[currentWaypointIndex].position, speed * Time.deltaTime);

       
        if (transform.position == waypoints[currentWaypointIndex].position)
        {
            currentWaypointIndex = (currentWaypointIndex + 1) % waypoints.Length;
        }

     
        Invoke("MoveToNextWaypoint", 0);
    }

Hi guys sorry. The object that have this script moves funny, like really stupidly fast. Any rreason why? 😦

thin mesa
#

once you initially call MoveToNextWaypoint it will then begin calling itself over and over

stuck onyx
#
IEnumerator OrientationChangeChecker()
    {
        while (true)
        {
            #if UNITY_EDITOR
            Orientation = UnityEngine.Device.Screen.orientation;
            #endif
            Orientation = Screen.orientation;
            yield return new WaitForSeconds(0.5f);
        }
    }````
Would this be a bad approach ? im worried about using the while(true) but i want this to be checked during the lifetime of the game.... also.... is waitforseconds going to create garbage or can I use it like this?
bleak citrus
#

while(true) is fine as long as the loop eventually yields

#

WaitForSeconds is a class, so i would expect it to result in garbage

#

but...probably not the biggest deal

stuck onyx
#

i was using a waitforendofFrame but i found it excessive too

bleak citrus
#

this runs once every few frames

stuck onyx
#

its a damn sudoku so 😅 but its a test for a game company so they are gonna be picky

bleak citrus
#

oh right, one thing

#

if you're REALLY picky about memory usage, you can just make a single copy of the WaitForSeconds and return it repeatedly

stiff hornet
stuck onyx
#

whats the difference? the class being reused?

stiff hornet
#

yeah, it's only allocated once

stuck onyx
#

aaah, very clever

#

thanks a lot, never did it before

bleak citrus
#

I do this for stuff like MaterialPropertyBlocks

stuck onyx
bleak citrus
#

it can be as goofy as

#
public class Something : MonoBehaviour {
  private MaterialPropertyBlock block;
  void Awake() {
    block = new();
  }
}
#

or, if you really want to go the extra mile

#
public class Something : MonoBehaviour {
  private static MaterialPropertyBlock block;
  void Awake() {
    if (!block) block = new();
  }
}
#

i asked about this on the forums a little while ago

#

this gets very goofy very quickly :p

stuck onyx
#

ah ok i get it now

bleak citrus
#

I do something similar for things like physics queries

#
private static Collider[] justOnePlease = new Collider[1];
stuck onyx
#

im creating each time a new property block Im seeing

bleak citrus
#

i use that for a function that tests if any colliders are in an area

#

i don't care which collider I get

stuck onyx
#

but didnt find any issue

bleak citrus
stuck onyx
#

hmmmm, ill note it down

bleak citrus
#

I noticed it when profiling one of my games. I was creating a block for every single mesh on a character every frame!

buoyant stratus
#

Hi; I've a super swift question about Unity's Entities package. I've been considering learning it for a project and am currently trawling through documentation to try and understand how it works. My question is about unmanaged components; can you store Unity objects like Texture2D's, Meshes etc. within unmanaged components, or do these have to be done with managed components. I ask as a key component of my game will be runtime generated meshes and such, and I'm trying to scope out how that might look in my head. Thanks!

#

I was trying to study some of the components in the Entities Rendering package, as they have components that reference Meshes and Materials, but I couldn't determine if they were considered managed or unmanaged components.

river totem
#

How Idle Games Handle Huge Numbers?

regal olive
#

i don't know if this counts as a coding question but

#

is there a way to connect two projects together like two clients? i am in this scenario because i am trying to run a server on my android version and join on my pc version (both are different projects)

#

using mirror btw

alpine sinew
#

On Mirror, how can I find a spawned object via its netId? I'm trying the following:

 NetworkServer.spawned.TryGetValue(elementId, out NetworkIdentity networkIdentity)

...but apparently NetworkServer.spawned is an empty dictionary. This is occurring on a newly connected client. The client joins, and all over SyncVars are good -- but when the client tries to refer to a network object via the netId the dictionary is just empty.

dusty wigeon
# regal olive using mirror btw

I would be surprise if you can by using mirror. I am expecting mirror to make some assumption on the structure of the project for the network identity of the objects. You could probably find alternate means to control the identity, but it would be ill advice to go against what the library was intended for. I suggest you look in alternate network solution that are of lower level in term of their entanglement with Unity. I would suggest you look into Unity Transport which is what Netcode for GameObject is build on. (https://docs.unity3d.com/Packages/com.unity.transport@1.3/manual/index.html) However, note there is a variety of possible solution.

https://docs-multiplayer.unity3d.com/transport/current/minimal-workflow

regal olive
regal olive
#

would you be able to provide a simple solution

#

for mirror

#

because gonna be honest

#

my game depends a lot on mirror and removing it and replacing it would take a long time

dusty wigeon
#

Like I said, I do not think mirror is made for such enterprise. However, I do not know if there is any work around. You may want to find other means to get what you are trying to do.

What your game use Mirror for ?
Why does it suddenly require a separate project ?

dusty wigeon
regal olive
#

i have target specific packages btw

bleak citrus
#

unity transport is just a protocol for reliable data transport

regal olive
#

so using conditional compilation is not an option

bleak citrus
#

it does sound like you're going to need to do something pretty elaborate here

dusty wigeon
#

I am pretty sure you do not need to make a separate project for that.

regal olive
#

like i said

dusty wigeon
regal olive
#

oh

#

well still i would like to know if there is any way to do what i asked

dusty wigeon
#

I've done game on Switch, PC, PS4, PS5, XboxOne, XboxSeries without require an other project.

regal olive
#

well i'm doing android and pc

dusty wigeon
#

Which should be the same.

#

It is only a different target, but everything works the same.

regal olive
#

alright i'll try to combine them

dusty wigeon
cunning mirage
#

I am trying to have a line renderer move with a game object. I have a line prefab that is instantiated on mouse down that has an edge collider. the points are made as the mouse moves. I have a script that sets the prefab as a child of what it collides with. When I move that object the line drawn does not move but the edge collider does move and I want the drawn line to move as well. this is in Unity 2d

somber pendant
#

Hey guys... i have a class with [Serializable] but when i do a test deserialization, none of its public parameters are deserialized. The class itself is deserialized but all of its variables are not.

It looks like this basically:

[Serializable]
public class CharacterDefinition : Definition<CharacterInstance>, ICharacterDefinition
{
    [SerializeField]
    public int Health { get; set; }
}```
#

the test data is

"TestDef": {
        "ID": "Testt2",
        "Health": 3
    }```

It deserializes with an empty ID and health is 0.... So for whatever reason the serializer isn't liking it.... The base class is serializable as well so i don't get it. I would expect an exception or something if it was truly not deserializable, but it seems to partly deserialize properly
dusty wigeon
somber pendant
#

Ah thanks

#

Well now I need to rethink my whole design approach lollll

untold moth
somber pendant
#

Oh interesting... I probably need to still re-assess my design.

Basically i have a data driven game with the concept of Definitions and Instances, i think i over engineered it though.

A given implementation of a Definition would have a shared interface with its Instance which defines the shared properties.

A better approach might be to have Instances derive from Definitions so there's no need for a shared interface

hybrid belfry
#

Hello, how can I loop through a list in a SerializedProperty array?

austere jewel
hybrid belfry
#

I'm a little further now, I have the element as a SerializedObject, but there doesn't seem to be a property for Transform type

austere jewel
hybrid belfry
#

Thanks a bunch, figured the rest out. Works perfectly 😄

stiff hornet
stiff hornet
round cobalt
#

Did you figure it out? As a shader programmer I'd really appreciate the feature. I am looking into this because I am wondering if it's possible to write custom shaders inside of vrchat.

queen mortar
#

does anyone know any good resources on flowfield pathfinding algorithms?

hybrid belfry
bleak citrus
#

pretty

queen mortar
#

are you following a tutorial or anything?

hybrid belfry
#

Look up Turbo Makes Games and find the Flowfield vids

#

Mines has changed quite a bit since it was based similarly on his code but nothing much remains except the algorithm itself 😄

tiny pewter
#

i think flow field is basically per compute distance to target in all nodes, you can run dijkstra

hybrid belfry
#

Since Dijkstra starts from a center point and spreads outwards, I don't think there's a point in using it. I don't know the intricate differences but I know PA and Supcom use flowfields. A flowfield is effectively a modified version of dijkstra's algorithm

tiny pewter
#

you start from target node then relax all the vertices

bleak citrus
#

yeah, it makes sense for a uniform grid

tiny pewter
#

unweighted graph we can use bfs

hybrid belfry
#

Yes but you don't want to scan all nodes, if that is how dijkstra alg works

bleak citrus
#

the important bit is that everyone learns how to get to a position

#

rather than only someone

bleak citrus
hybrid belfry
#

I'm aware that a grid can be scaled and tiled more easily I guess which is what you'd want for large scale RTS. I guess that's why SupCom and PA use them

queen mortar
bleak citrus
#

i'm trying to remember the name of another algorithm

#

it computes the path from every vertex to a destination

#

oh wait, it's every pair of points!

#

Floyd-Warshall, right

#

O(n^3) cost, but I guess you can just do it once and then go to bed

queen mortar
#

and DOTS is scary

bleak citrus
#

very scary

#

I got a basic game working

#

I came back to it a half year later and I'm having a fun time remembering it all, haha

#

I made a LOD system so that I could zoom in from earth-scale all the way down to human-scale

#

replacing cities with blocks and blocks with buildings and people as you get closer

queen mortar
#

oh cool

bleak citrus
#

it is very wonky, since I avoided using child transforms at all

#

(they were slowing it down a whole bunch)

bleak citrus
#

they'd just form up and all get guided by the agent

queen mortar
#

yeah...

bleak citrus
#

but that would be very rough

queen mortar
#

I think flowfields would be best though

bleak citrus
#

they'd get stuck on walls, or you'd need to make various agent settings for various sizes of squads

#

yeah, flowfields sound like the way to go

tiny pewter
#

flow field is good for multi sourcessss single target

#

many sources

bleak citrus
#

yeah, that makes sense

#

floyd-warshall is any source, and target

#

whilst this is any source, one target

#

and djikstra's is one source, one target

tiny pewter
#

djistra is single source multi target actually (since you compute all shortest path to other vertice, can be reversed as multi source single target)
a star is single source single target

bleak citrus
#

oh right, I forgot about that...

#

I always scramble up A* and Djikstra's

#

neat

tiny pewter
#

normally you run path find (single direction path find) from sources to target but flow field you run from one target to all sources

queen mortar
#

what I think I have to do is have separate pathfinding for unit-level and model-level

bleak citrus
#

"model-level" meaning individual guys?

#

i'm sensing a tabletop player :p

queen mortar
#

total war player lol

queen mortar
bleak citrus
#

i briefly looked into 40k when i entered college

queen mortar
#

I'm trying to recreate a total war-style game

bleak citrus
#

i think i bought a block of tiny dice, but that was it

#

lol

queen mortar
#

I tried 40k for a bit, but it was so expensive and time-consuming

tiny pewter
#

maybe you can just group many unit together and find their centre node then start path find....but i have never think how to implement, just a idea, since the word "group" is too abstract, no any solid rules to describe it

bleak citrus
#

yeah, that'd make a lot of sense in a Total War setting

#

you control blobs of guys

#

You might use short-distance pathfinding to help them navigate through obstacles

queen mortar
#

yeah so I have them separated into units like this

bleak citrus
#

that unit is about to get separated into pieces

#

oof

queen mortar
#

lol true

#

so each unit has an array of nodes corresponding to each soldier's target position

#

when the unit moves, the soldier will try to follow that target node unless it is given another command (like fighting an enemy along the way)

#

I'm not exactly sure how I would implement flow fields here, but I'd probably want the soldiers to follow the flow field to the unit's center when they're following the unit, and then if they reach an enemy or get close to their unit, they'd use navmesh to get to their node or a close enemy

bleak citrus
#

i wonder if you could just have each soldier navigate to its "spot" in the formation

#

and then have the whole formation navigate long distances

#

that would be lots of short-range paths

queen mortar
bleak citrus
#

ah, and it's still grinding to a halt?

queen mortar
#

well, not exactly a halt

#

but it could be a lot faster

#

and it gets exponentially slower the more soldiers I have

bleak citrus
#

hmm

#

i wonder how it'd look if you just blindly moved the soldiers into position

#

they'd get caught up in corners sometimes

#

maybe you could turn on pathfinding if they get too far out of position

bleak citrus
#

lore explanation: they're very badly trained

#

I am curious what Total War does

#

i don't have a lot of experience with it (i mostly just saw the mandaloregaming reviews, lol)

queen mortar
#

but I'm not sure

#

might be interesting

bleak citrus
#

you know it's gonna be good when you have greek letters on top of some serious mspaint drawings

queen mortar
#

right now a battle of ~1000 soldiers runs at about 50-60fps when everyone is on screen, and about 100fps when looking away from the battle

#

so a lot of it is down to animations (which I have optimized a lot) and rendering