Star Citizen: Bugsmashers! - Cargo and Coordinate Systems
Transcript — every row opens the video at that moment
- 00:00:16
hey everyone welcome to bug Smashers I am your host Mark aent and I'm here to show you the bugs bug [Music] bashes hey we are here on an awesome planet and I just stole some cargo from that Drake ship and what's cool is I could actually place this down anywhere I want but I want to place it in my ship so let's walk up there and O it's hitting the shield that's fun but oh no I can't place it into my ship I can't loudly enough I can place it outside with an awesome jittery bug oh no what's happening well my crate vanished I've officially
- 00:01:05
lost my crate and it's back all right let's take a look and see what is happening but before we do um which to say what's going on is if I hold down F I go into this awesome new interaction mode that's going to be coming for 3.0 um where it shows me a list of things that I can interact with and if I click place I could interact with this cargo Grid or cargo container that I have and I could place it on the ground now ideally I should be able to place it anywhere so I can place it on the planet and I should be able to place it on my ship however going into the ship I have a hard time because well this planet actually has a coordinate system and the ship has a coordinate system and when I cross between the planet's coordinate system to the vehicle one all
- 00:01:53
things just go Bonkers so let's step into the awesome code so here is is um the player choice component this is the thing that when I hold f it allows me to place the uh cargo thing around or do some kind of interaction and unfortunately this guy is doing everything in World space so when I try to place the cargo grid into the ship it's freaking out because it can't figure out between the planet Zone and the ship Zone where it should place it and if I actually move it from World space or the whole or let me step back in our whole universe we have a root U coordinate system then we have a planet and then that planet has its own
- 00:02:39
coordinate system and the ship has its own coordinate system so if we do everything in World space we're technically doing it in the higher up um basically the universe's coordinate system and things get freaky when you try to do a gigantic uh you know the outermost realm TR Trace into to there instead we should be going to the very deep coordinate system where we are and doing our tests in that coordinate otherwise if you're on the very outskirts it has to try to figure out where it's own it just goes Bonkers so we need to make sure everything that we're in is in the correct pinate system so since we're using the eye position of the player and the direction based on uh the screen coordinates so basically wherever my screen is we're projecting
- 00:03:27
it into the um this the zone or in this case world we should be changing both of these to the zone so first thing we need to do is get the zone that the player is in zone we ask the player he has an entity like hey you give me your zone so this is the zone that the player is currently in we want to get his eyes in zone space so instead of world space we do Zone space cool and this direction that gets projected from the screen to uh the game is in World space therefore we need to translate them into the correct coordinate
- 00:04:15
system so let's translate World space to Zone space we got to do it right here and right here so this will convert my starting camera position to where I'm pointing from World space to Zone space so that's awesome we have a position in zone space we have a direction in zone space but now we need to tell physics we're doing everything into this specific zone so we'll tell wh H where is it we need get physics grid get we got to tell physics we are going to be in this
- 00:05:04
specific um coordinate system using the position and Direction hopefully we'll now get a ray Trace hit but when we get a hit uh unfortunately there's still some code that's still doing in World space so we need to translate that hit position from Zone space back so convert Zone space to World space Shazam and let's recode and see what happens as it recodes I'll explain it again uh we have pretend this whole room is uh the universe and this is our root zone or our world Zone and we have a planet which is pretty cool and that has its own Zone which means it could have its own gravity and basically
- 00:05:52
everything's in this guy it's a partitioning system it's pretty cool but we also have a vehicle it's kind of a big vehicle but when he gets into uh the zone of the spaceship he could actually rotate around and he's basically affected by the gravity of the ship or I'm sorry the U the planet instead of the root Universe system now if you have a player I don't have here's a little player we stick him into the ship he's actually in the zone of uh the ship so where the player is in the zone of the ship which had his own gravity so he'll be pointing up in the planet Zone rotating around inside of the universe and what we just did is make sure that when we do this R Trace we're doing it relative to the player so if he's in the ship we're doing the rate Trace in the
- 00:06:41
zone of the ship if we on the planet we're doing the ray Trace in relative to the zone of the planet so I could place the um the crate in the planet cuz I'm in the zone then when I Traverse into the grid of the the ship I'm now doing everything relative to the ship so I just finished recoding let's see what happens we'll pick up this lovely box and I am going to run up the ramp in a peaceful walking Manner and let's try to place down come on hold that I got stuck all right so let going to try to place down so I can
- 00:07:31
place somewhere inside of the ship somewh place in the ship yeah oh gosh he's teleporting well kind of got placed down but what happened now what did I break I broke something hit hit hit
- 00:08:33
let's skip that crate again Spa a crate where my crate go one thing goes wrong everything goes wrong why ah there's a crate give me a crate all right so Reco is just finished let's try placing down this crate whoa so place it down anywhere I want in here in the outside world everything's fine and dandy let's go up to the ship you're going to see it snap right
- 00:09:23
there cuz it's actually in the um uh where we oh there we go it's actually hitting come here you why aren't you sideways when one thing breaks it all breaks Zone space
- 00:10:31
why are you now Aha and of course it would help if our rotation in this bit was actually in the proper Zone as well so this guy also needs to be in the correct Zone give me
- 00:11:26
all convert to give me the Zone give me the Zone we are convert Zone space to let's try this real quick so one thing breaks everything
- 00:12:41
have to do another fix well I actually discovered another bug in this thing well discovering the other one the rotation is all messed up so I have to fix that one now you get two bugs for the price of one so what happened here folks is um unfortunately since uh we converted the race successfully to um the correct Zone and we had to get the position back into World space because this is how this bit of code works but unfortunately the part that figures out where it should place it on the rotation uh it was assuming that the player's rotation was always in World space but but it's not so we have to convert that back into World space so
- 00:13:31
that this could do the correct rotation up so if I place him down oh recode why you know work yeah where's this rotation I managed to crash the entire [Laughter] game yeah two excruciating days where we didn't think we were going to have a show later Jared is it fixed
- 00:14:21
yet it's been two days I don't think it's working H at least we have a beautiful scenery all right guys let's test to see if this fix actually works now we're going to do the impossible cross the boundary and try to place a crate woo so I'm now going to try the impossible and place a crate down and see what happens place the crate rotate a bit and the crate's down h oh we have successfully crossed the Zone in another Zone and placed a crate down with minor rotation so what did I do let's go to
- 00:15:09
the code so here's the fun uh big old thing that we were looking at last time where in this local player choice component if you hold F you can look around and pick where you want to place stuff in a crate and it was doing everything in World space and the fix originally was to move the ray cast so that it was in zone space and everything else would be kind of in World space problem was the placement and rotation got all out of whack so I literally went through this entire thing and transformed everything which should be in zone space or World space correctly so all of our transforms are now so when we place this thing down it does everything in zone space and even moves this invisible thing into the correct Zone when appropriate and when
- 00:15:59
we spawn where is this magical Beauty when we spawn this holographic thing that thing you saw when we placed it on the ground we make sure that it's in the correct Zone and this placement position is in the zone PL or rotation um and spot so now that everything's in its own space everything appears to be correct the only issue now is the player kind of tilts that's a completely different issue and that will be one for next time hope you guys enjoyed behind the scenes of game design and game programming where one thing you think goes right ends up going bonkers hope you guys enjoyed till next time so as you guys saw we had a fun little bug with the new feature where uh we have a crate in the player's hands and you hold F and you want to look around to place it down it was doing all of these calculations in
- 00:16:48
World space but unfortunately when we have a gigantic planet and a ship um each of those have their own little coordinate system inside of it so when you go inside we have a coordinate system system and a coordinate system and a coordinate system and doing all this Ray casting in the world space instead of that specific coordinate system tends to cause some issues so moving it all into the proper zone system and transforming everything relative to the correct coordinate system resolve the issue and you were able to place crates from the planet into the back of the ship hope you guys enjoyed until next time thank you for watching so if you want to keep it with the latest and greatest and Star Citizen of Squadron 42's development please follow us on our social media channels see you soon
Transcript from YouTube’s automatic captions — punctuation and Star Citizen jargon are approximate. The video itself is hosted by CIG on the official channel.

