- UID
- 40326
- UCC
-
- 声望
-
- 好评
-
- 贡献
-
- 最后登录
- 1970-1-1
|
HarvesteR's Dev Blag
by HarvesteR , Yesterday at 18:43 (4193 Views)
Hi again,
As many of you already imagined, docking makes it possible to have multiple command pods in the same vessel. That creates an interesting problem in which only one of these pods must be the active one, otherwise things just wouldn't make much sense.
This might sound weird, but as far as KSP is concerned, the command pods themselves have nothing to do with how a ship is controlled -or didn't, until now, but I'll get to that. The player Input is handled by an external component that processes all keyboard and joystick input, and provides a FlightControlState object, which is sent to all the parts in the vessel. That control state object can be thought of as a snapshot of the controls on the cockpit, and each part will then read it and respond in its own way to the given input.
That means command pods don't really have anything to do with how a vessel is controlled. A vessel with two command pods would work just the same as a vessel with one, or twenty, or none.
So, why is there such a thing as a multiple pods problem? Well, even though pods aren't important to ship control by themselves, there is one part on every vessel that is 'special'. That is the vessel's root part. The part around which all other parts are connected. The vessel is centered around that object, and it defines the orientation of the vessel. How do we know which way is forward to a ship, or which way to rotate when you pitch down? We use the root part as our reference.
So, up until now, the root part and the command pod just happened to conveniently be one and the same for all designs. That was because the editors wouldn't let you do it any other way. You placed a pod on the building area, and that became the main, undeletable part for that ship forever.
Docking kind of ruins that notion though, because we are now allowing vessels to exist with multiple command pods, and those not necessarily as the root of the vessel. That creates a problem in that you'd logically expect your command input and your instruments to work relative to the command pod, and now not only the pod can be rotated in any way in relation to the vessel's root part, there might be more than one pod to choose from.
So, the multiple pods issue is largely a UI one. The game itself doesn't really care about which particular way is forward, as long as one is, but it wouldn't make sense to the player to orient the ship right side up to the surface, only to find that the cockpit is now upside down and facing backwards.
An interesting problem, definitely.
The solution was thankfully a simple one. If the game doesn't care about which way is forward, that means we can arbitrarily set any way to be forward, and the game would be ok with that.
So that's what we did. Now, instead of assuming the vessel's root part will be our reference, vessels keep a reference transform that can be set to anything. That not only solves the problem, it creates a feature.
When you dock to a vessel, a reference transform is selected by default to the first "command" type part available. That's just a suggestion though, because now, CommandPods and the like have a right-click action to let you "Control From Here".
That means you get to choose where you want to control a vessel from. And more interestingly, that also means you get to place cockpits in weird rotations, and have multiple ways to control a vessel by. Want to control a stricken Apollo 13 CM replica from the LEM? Just make sure the LEM is manned and select "Control From Here" on it. Your instruments will be reoriented so that all controls and gauges are relative to the LEM part.
Also, if you go to internal view and cycle around, your reference will be set automatically, depending on which Kerbal you're currently focusing.
All this effectively solves the multiple pods problem then. This means there is also no reason now to require you to place a single pod on a vessel in the editor, and so we are also removing that limitation. Expect a pods tab in the parts list on 0.18.
Cheers
Tags: docking
Categories Developer |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
×
|