Search the Community
Showing results for tags 'internalmodule'.
-
Hello everyone, I have a question about IVA animation/rotation. Is it possible to rotate / animate the origin of an InternalModule through a KSPEvent tied to a PartModule? The reason why I'm asking this is one, I'm very new to plugin development (very ignorant about what's possible or not), and two, I don't want to waste time trying to solve the impossible since this is the only reason I have to learn plugin development. For context, let me explain what I'm attempting to do. The plugin I'm trying to write is a PartModule called ModuleCentrifuge. I would like to (ideally) define a KSPField public integer called rotationalVelocity which defines the speed of rotation for the centrifuge animation. It is important that the craft be rotated through animation in a non-physical manner, to avoid physics calculations. A animation is then defined which rotates the part along the y axis (up / down in the VAB) as well as an expected attached internal space Another KSPField public float called ecRate defines the amount of electric charge consumed when the centrifuge rotates. Two KSPEvents are defined which are called "Start Centrifuge" and "Stop Centrifuge" which starts or stops the rotation of both the PartModule and InternalModule The impetus for creating this plugin, is to facilitate proper window view orientation in rotating centrifuge habitat IVAs. Any help / clarity / advice would be very much appreciated! EDIT: After teaching myself enough about both c# and the KSP plugin API, I have determined that, yes, everything I wanted to achieve is possible. Instead of rotational velocity I used rotational degrees per second (well, actually rotations per minute divided by 60). instead of two separate KSPEvents I use one to toggle between start and stop states utilizing Events["nameOfEvent"].guiName = "newGuiName" rotating the external model is accomplished by accessing the parent Part class, part.FindModelTransform(name of transform), assigning the found transform to a variable and then using Transform.Rotate(0, angle, 0) rotating the internalModel is accomplished by accessing the parent Part class child object internalModel which has the same method of FindModelTransform, so part.internalModel.FindModelTransform both the external model and internal model are accessible from within the partModule class, so there's no need to mess around with making a separate instance of internalModel.