#💬 eeeeee1234567890123456789ʹs Feedback
1 messages · Page 1 of 1 (latest)
why didn't u show it running in real time so we could see the actors
obs would shit on my pc
thats what actors are for tho
if i start recording you will see 20 fps 💀
yes
then i do this 💀
u want pro tip
yes
when you are comparing distances and you don't actually care about the distance itself you only care about it's relative value you can use square magnitude
which looks like this:
local v = Vector2Position - Vector2.new(At.X, At.Z)
local sqareMag = v:Dot(v)
local isInCircle = squareMag <= halfRenderDistance^2
its wayy more efficient because it skips the square root function that Magnitude uses
whoa math
i can explain the math if u want too
but it boils down to v:Dot(v) is equivalent to the inside part of the distance function
no thanks 💀
i wont get a single thing
you underestimate yourself
code died 💀
you know how distance =√((x2 – x1)² + (y2 – y1)²)
yeah
v:Dot(v) = v.X^2 + v.Y^2 and v is already the difference between the two vectors
(x2 – x1)² + (y2 – y1)²
so it just does the inner part of it
can i see what you originally had on the full IsInCircle line
you cut off a part of it
accidentally fixed it 💀
also the memory increases a lot when generating (would eventually stack up to a gigabyte) should i eventually with time remove old chunks?
when you set _AlreadyGeneratedChunks[V3SnappedPosition] what do u store there just = true?
i store the model
but since i cant initialize it as nil
i put it in a table
later on i find that model and put the model to that table
as shown here
that findfirstchild isnt the best but it is the easiest for me currently
storing models is pretty space efficient actually so you should be fine there I think it's fine just probably because you're creating so many parts at once
yeah converting to a string and using findfirstchild could probably be improved upon
also find a way to not use pairs
i should eventually clear old chunks
is it that big of a difference?
ipairs and pairs?
yes
ipairs much faster than pairs
and when you're doing it a lot it makes a difference
also my current way of checking if a given space is already occupied is just indexing it, would using table.find be better
or is there any alternatives
well i cant index it if i dont have the index 💀
what are you using for an index
the snapped position of the chunk
thats fine then
converted to vector3
you can just get the close by grid snapped points
and use them as indexes
which should be pretty fast to get
?
like get nearby vector2 values and check if they're occupied
is that not what im doing?
you're going through already generated chunks tho? maybe im confused
well yea, gotta remove those chunks that are outside of the "renderdistance"