#spherecast doesnt work
1 messages · Page 1 of 1 (latest)
Keep in mind, it outputs List<Collision Data>
Using List Get Element and getting the first element in the list (index 0), you will get the closest player, you can then use Collision Data Get Player to get this player
Keep in mind it will error if you try to get the first index when there is no one in the list, you can fix thix by checking If List Get Count is Greater Or Equal to 0
Input a position and radius
When executed, it tells you every player/object inside the "Sphere" at the position of your origin, with a radius of the input radius
- Like I said, it cant detect anything in the starting radius
- It sucks ass for tag systems, you can trust me, I made ^HotBomber_2, which uses local overlap sphere tag detection, very reliable
?
Overlap Sphere has 2 outputs:
Exec - Fires when function is finished
List<Collision Data> - Tells you everything inside the sphere
You need to execute the chip for it to return anything, hence the execution input/output
Yes, you can use the Update 30hz event
Wdym?
Count: 1 means there is one item in the list
Overlap Sphere, when executed, returns every player/object inside its radius
You can configure the chip to ignore objects, this way it only detects players
Keep in mind, it outputs
List<Collision Data>Using
List Get Elementand getting the first element in the list (index 0), you will get the closest player, you can then useCollision Data Get Playerto get this playerKeep in mind it will error if you try to get the first index when there is no one in the list, you can fix thix by checking
IfList Get CountisGreater Or Equalto0
Kirito did u ever play crownsofwarpvp
Make a custom manual loop to iterate through each item in the list
On loop, if Collision Data Get Player is local
Then > Next
Else > Tag player
You can get yourself a cheap manual loop here:
https://rec.net/invention/3105428975347742529
The loop I would recommend using is the Manual For
Run from 0 to List Get Count
Loops go hard , some real programmer shiz right there ^
So yes or no
Also do this #1165750014400798851 message
If you overlap sphere from your hand then you will always detect yourself along with whoever else is in the bounds of the expanding sphere
Therefore you need to "loop through" the list of collision data to check all players that were detected
Most of the time there will only be one player detected (you) but when you touch another player with the hand they will almost always be the second collision in the list of collision data
It detects everything in the sphere
I think we mean the same thing
Yes, but to make circuits that take advantage of this you will need a way to check every collision data in the list of collision data supplied by the sphere
To allow you to tag multiple players in a single frame
Do you know how loops and lists work together?
Do you know what lists are?
Do you understand the overlap sphere gives you a list of collision?
Okay building up to loops, the list you get from overlapshere can contain a list of random count, depending on how many people your sphere collides with
Does that make sense ^
List count is how many elements are in a list
Okay, so now you need a way to check for all the collision data elements in the list for players who should be tagged
What if 3 players shove their hands all in one spot
You would get a list containing 3 collisions
Each with a player
You don't care about the collision that is with your own hand, so there will always be 1 collision in the collision data list that we don't care about
So you need a "loop" that with check every element in the list
If there is a list of 3 collisions, then you would need to use "getElement" chip for indexes 0,1,2
But what if 20 players all had there hands together (rare but should be considered)
You certainly would not want to place 20 get element chips each with a different index. EX: "getElement(0)" "getElement(1)"...
"getElement(18)"
"getElement(19)"
Rip
It would be best if someone joined you and explained
But I don't have rr
Yup
Assuming 20 players all touch
Realistically you will only get like 3 collisions max
As 4+ players is rare
Okay now for the solution
You only need one list get element
But it will be used multiple times in a single cv2 "frame"
Because we will make a "loop" with our execution
Every time we call getElement again we will use an index 1 higher than the last
Oh yeah
Yes we will have 2 "loops" one for each hand
The above image is the loop to make
We will use an int variable that will start at 0 and will increment up to the "count" of the list
That way the int variable will be at some point every single index in a list
Okay so cv2 will execute in "ticks" where in a single tick every chip executes besides delays
So In a single tick we can set x to 0, then 1 , then 2 and so on untill we run out of CPU for that tick
We only need our index variable to go from 0 to "listCount" - 1
It would go from 0 to 1 in one tick, but every time we change it in the tick, we use it as the index in the getElement chip to check the collision
If the collision list were 20 than yes 0-19
We will check all the 4 collisions in the list (one is you) and if they don't have the tag role then we add it
No, in 1 tick it will do player 1,2,3 all of them unless we run out of CPU before it finishes
Il send a photot
The diagram above shows in a bad way how to make a loop that increments the value of an int variable from 0 to 9
If cryptic is available he could easily explain this
I just don't have rr rn so it kinda sucks
It is a placeholder for chips that set int variable equal to what it already equals +1
Yes
But
Set the 0 of the add chip equal to the current value of the int variable chip (what the int variable outputs)
And wire the then output of the if chip to the start of the int variable
Send screenshot when done
Yes but the "then" output should go into the int variable
My diagram is wrong for that lsrt
Part
Fix and send screenshot
Almost good, the 0 in the add chip should be a 1
That way it actually increments up by 1
Also add a button and connect it to the int variable too
If you press the button then the int variable should count up from 0 to 100000000
(but cpu will run out first)
Add button now
Press it and tell me what the int variable counted up too
If you did it right you will also get a cv2 error
Ohhj
The less than chip
The 0 there
Will be the number you count up too
Set it to 100
The less than chip 0
Change it too 100
Noice
But we not done yet
Have the button set the int variable to 0 at the start
Cuz the variable is now stuck on 100
It needs to reset everytime
Also it won't go to 100, only 99
With is fine that's what we want actually
All you need to do is duplicate the int variable and set it to 0 at the when you push the butt
On
When you duplicate a variable it is the same variable unless you rename it
So if you set the duplicate equal to 0 the other one gets set too
Connect the execution output of the variable you set to 0 to the if statement
Yes
Add delay
Chip
Between each iteration
Get rid of the run and cancel outputs
Use after delays
Your right
Delay
Delays make it take multiple ticks
But it's okay
Cuz it gets rid of CPU
U actually don't need it
Cuz you won't have 50+ collisons
Nuce
Nice
You made a for loop
Now every iteration check a collision with it
I gtg