Jan 19

Bugsmashers: Caterpillar Doors

In this episode of Bugsmashers, host Mark Abent shares a problem with the cargo bay doors on the Caterpillar and how it he fixed it.

This post is a transcript of Around the Verse Special Edition: Alien Languages, material that is the intellectual property of Cloud Imperium Games (CIG) and it’s subsidiaries. INN is a Star Citizen fansite and is not officially affiliated with CIG but we reprint their materials with permission as a service to the community. Enjoy!

Bugsmahers: Caterpillar Doors

Hey, everyone. We’re here inside the Caterpillar and we have a bug where these fun cargo doors sometimes don’t open or they open incorrectly. These doors are special because there’s an interior part and exterior part. So you can think of the interior here and the exterior here, and when you open it, they’re supposed to coincide. When you close it, they’re supposed to go together, however when you look away from the door the exterior opens, but the interior remains where it was until you look at it and then it may start animating or just get stuck.

So, if we open it up, we can see everything looks fine. If I close it and look away, it’ll take a bit. Bam! We can see the exterior door close, but the interior which it should show this metal stuff with Drake on it and all that panels is not closed.

So, the interior, we can actually fly out. The exterior closed, the interior has not. So if I run over here and hit close, you can see it snapped to the close position and now it works correctly.

So, what’s going on? Well, there’s a bit of code that says, “Hey if this thing is visible, we can fire off the animations”.

The idea is it’s some kind of optimization so if there’s a ship way out there, I don’t have to animate it because why take up all those CPU cycles, but unfortunately when we’re inside the ship, the exterior knows that we’re potentially visible so it animates, but the interior when we switch this way, that CGA in the back is not owned by any entity it’s just there, and because of that it doesn’t animate correctly.

Even though it’s attached to the animation of the ship, it’s just called out because it’s like, “well it’s not visible so I shouldn’t have to worry about it”.

So, I have this bit of code in Mannequin, if I enable it, what this will do is it checks to see if this entity has a parent which is going to be the ship and if this door, the interior is enslaved to the exterior and the exterior is visible, then we allow it to animate even though you can’t see it. The idea is if you can see the exterior, then you should potentially see the interior when the door opens and closes.

So what we do is if the owner entity which is going to be the vehicle which is going to be the exterior door is active, but the interior door is not, we’re going to force it to be active. Same thing down here, so we’re forcing the entity to be active and we’re forcing the skeleton to be active. What that will do is, this will allow the entity to do an update call to tell the animation system, “Hey I’m active, so go process my animations,” and this will allow the skeleton to actually function.

So, two updates we have to do. Entity system wanted to say, “Hey, animation, I’m ready”, and the animation system will go, “Yep, I’m ready too”. So, in theory, this should allow if the outer door is ready, the inner door will be forced to be ready so they can open and close together.

So, let’s hit the re-code button and take a look at what happens. OK, re-code is done, let’s start back up the game, alright!

So, we’re back in the level and let’s close the door. Magic door close. We won’t look at it. Wham! It’s closed, as you would expect. Alright, let’s open it again. Let’s not look at it, not look at it, and it’s open!

So, now we’re getting the interior update when the exterior is updating. So if I close this, going into another room, open that door, go to the other room it’s closed correctly and this room should be open correctly.

So, if the interior is not updating, but the exterior is, we say, “Hey! You should be, because we’re updating both” and then they both play the animation, everything works well and you could open and close your doors just by not looking at it. Well, hope you guys enjoyed, till next time! Wew!

So, as you guys saw we had the Caterpillar and it’s just a gigantic long ship and it has all these bay doors in it and you’re supposed to be able to hit one or open one up and brings down the bay door and it’s a little bit of complicated geometry in this setup because we have an exterior mesh for the door and an interior mesh. So there are two doors at the same time that open and close and what was happening is when you’re looking at one of the doors it opened correctly, however, if you looked that way when the doors open, one of the doors would open, but the other would stay intact. It would usually be the exterior door that opened and the interior door when you’re inside, wouldn’t open until you looked at it and then it would start animating, but by then it would be too late, it would be stuck open or stuck closed. You could go around and hitting all the buttons and it wouldn’t move until you looked at it.

It was a simple fix, we just made sure that if the exterior animates, then we force the interior to animate at the same time. So the doors would open close even if you looked the opposite way. Hope you guys enjoyed, until next time.

About the Author:

Leave a Reply