How To Add A Punching System In Rec Room

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what is this ghost this does this today I'm going to show you how you had punching in your room in records so here we have my lovely sort of kind of Clubhouse let me make it daytime and we're gonna add the punching circuits to this wall over here so the main way that we're going to achieve this today is with a sphere cast now a sphere cast is very similar to a raycast but instead of shooting one single invisible beam it's gonna shoot an entire sphere in that direction but we're gonna make the distance so small that it basically encases our fist so whenever the area around our fist detects somebody it's gonna apply velocity to them by the way if you don't want to mess around with the circuits and you just want to add punching to your room I have an invention for you it's called the RCL punching system get that on the adventure store pop it in a room and you can start punching your friends so let's start off by doing all the circuits for the left hand and then we'll work on the right hand and then we'll do bug fixes let's start off by bringing our sphere cast over here so now that we've got our sphere cast in place let's start filling out all the inputs over here our starting position is going to be where our hand is so we need left hand position and we'll just leave the target as a local player a radius is going to be how much room around our fist do we want it to start detecting after experimenting a little bit it seems like 0.1 works but you can use whatever number you'd like I would suggest keeping it small so for directions we're going to use the player left hand finger Direction but ideally since we're going to keep it so close to our hand anyway I don't think it particularly matters as long as you put a vector in here so max distance you can't keep it as zero unfortunately that would be ideal so I would suggest doing a small number I'm just going to do 0.1 as well because that seems to work so I'm going to show you guys that this is working if we hover over hit here it's false because it's not hitting anything it's not hitting an object or player if I bring my hand close to my body it becomes true meaning that I am within this sphere around the around the fist so we want this circuit to be constantly checking if the sphere around our fist detects a player and if it does we want it to add a velocity So based on that sentence I just said we need something constantly checking which means we need an event receiver configured to 30 Hertz we need it to check if something happened so we need an if Chip and if that thing does happen we need to add velocity which is a velocity so we will go ahead and hook up the 30 Hertz receiver to the if Chip and then hook up this hit pull to the if condition remember if this is true then add velocity so now you can actually see every time my hand gets close to me that it's going to try to add a velocity but we don't have any of this filled out also a quick note here we're going to configure the sphere cast and make it only detect players so ignore objects okay so your Target that is going to be the player that we hit for the speed this is almost going to be like a multiplier for your punch I would keep it as one to start out with I'm going to put it as 10 because I really like the effect when you hit somebody where they go like flying off now for direction originally I used the finger Direction like we did here but I spoke to just a little kiwi and he told me about a chip I was unaware of that is left hand velocity so we're actually going to use that for the Direction all right so we have punching for our left hand but we have a bit of a problem we need to add in a system where it won't let us punch ourselves to do that we're going to need an and Chip a not chip and an equals chip I keep punching myself so I'm just going to turn it off for now so essentially what we're going to do is replace this bull variable with this bull variable we're gonna put the hit little variable into the top input of the and Chip the result from the not chip to the second input on the and Chip the output from the equals to the nut chip then the player that we hit is going to go into a on the equals chip and we're going to switch the B to the local player and actually we can go ahead and rehook this up so let's say hypothetically that your hand hits yourself this top hit is going to be true both of these have to be true in order for this to be true well these chips we just added are checking hey does the player that we hit equal the local player the ourselves essentially if it does equal ourselves then this becomes true which then going in here becomes false so if we hit something and that player is ourselves this will be true and this will be false which means this is false but if we hit somebody that is not ourselves this would be true these two won't be equal which will then make this false the knot will flip it to True which means both of these will be true which means this will be true and then we can go on and add velocity to the person that we hit hopefully that makes sense all right so now the right hand super simple all we need to do is select all of these chips except for the 30 Hertz and clone them then all we have to do is replace all the left hand chips with right hand chips the top [Music] [Music] then we just hook up the else on this first if Chip to the input of the second if Chip also I'm going to organize these a little bit because they're kind of all over the place now there is an issue that we found in testing again just a little kiwi helped me out with this essentially you would hit and it would hit them multiple times so essentially we've got to add in a system that only allows you to hit somebody one time within a certain time period so the first thing we're going to need to fix this is a float variable and we want to connect both of our ad velocities and then we want to use a get precise seconds chip we want to record these precise seconds whenever a punch happens yeah all right the game just kicked me out and didn't save any of this so I had to rebuild it real quick everything is the same it just looks it's a slightly different position but anyway so you take your float variable down here and your get precise seconds and you're gonna clone them up here to in between your 30 Hertz receiver and your first if Chip then you want to get a subtract chip and a greater than or equal we want to get the difference between the actual time the actual precise seconds and when our last hit was recorded then we want to take this difference and we want to check to see if that difference is greater than whatever time we want in between our punches I used 0.5 so that is you can only punch one person every half second then all we need to do is add another if Chip here so if the time is greater than 0.5 then we want you to go ahead and start checking you know let let the person hit somebody else another thing that I want to add because I think it's funny to be honest is a little like punch sound effect so all we need for that is an audio player I don't want it to be synced what we want to do is get a punch sound effect I have one up here already recorded I'm actually going to give it to you guys for free because I know not everybody can record sound effects easily and then every time we hit somebody we wanted to play our audio sample now is the time for testing what does this dose just does this are you flying but if you do just want to look at the circuits you don't want to get the invention or anything you can come into this room it's called use code rcl1 I'll have the circuit set up right here where we built them so you can take a look at them take pictures do what you need to do we're going to try something a little bit different this week I'm going to start making an after show I'm going to call it after connections and today we're finding out if I can be a professional boxer so go check that out there [Music] foreign [Music]
Info
Channel: theRCLman
Views: 16,637
Rating: undefined out of 5
Keywords: How To Add A Punching System In Rec Room, how to make a punching system in rec room, how to add punching in rec room, how to rec room, rec room how to, rec room cv2 tutorial, rec room circuits tutorial, make punching in rec room, rec room punching, how to add a punching sytem in rec room, how to rec room cv2, how to rec room circuits, how to rec room pvp
Id: nGKUJW8QRj4
Channel Id: undefined
Length: 8min 27sec (507 seconds)
Published: Fri May 05 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.