Jump to content

Recommended Posts

So, I want to create a plugin to add a wheel to the game to emulate a hovercraft.. The wheel should have the following properties:

  • Invisible wheel, visible around the attachment point.
  • Cannot be destroyed, even without cheats active.
  • Does not affect aerodynamics.
  • Has long suspension, meaning that too much stress can cause the vehicle body to scrape the ground.
  • Has suspension in all directions, instead of just up and down, if possible.
  • Constantly uses EC, otherwise the wheel will stop physical interaction, in addition to the EC required to make it move.
  • Can slide more easily left and right than forward and back, if possible.
  • Custom, or no sounds from the wheel hitting the ground.

Can anyone help me outline the steps I should take to implement this idea? I've never written a plugin before, aside from some basic part cfg editing.

Edited by AceNova
Link to comment
Share on other sites

49 minutes ago, AceNova said:

So, I want to create a plugin to add a wheel to the game to emulate a hovercraft.. The wheel should have the following properties:

  • Invisible wheel, visible around the attachment point.
  • Cannot be destroyed, even without cheats active.
  • Does not affect aerodynamics.
  • Has long suspension, meaning that too much stress can cause the vehicle body to scrape the ground.
  • Has suspension in all directions, instead of just up and down, if possible.
  • Constantly uses EC, otherwise the wheel will stop physical interaction, in addition to the EC required to make it move.
  • Can slide more easily left and right than forward and back, if possible.
  • Custom, or no sounds from the wheel hitting the ground.

Can anyone help me outline the steps I should take to implement this idea? I've never written a plugin before, aside from some basic part cfg editing.

You can probably achieve this without a plug in. A wheel is a set of colliders and meshes, the colliders are what the physics calculations use, the mesh is what you physically see. So If you made a wheel with no wheel mesh and just the colliders you'd have a hoverwheel.

Link to comment
Share on other sites

1 hour ago, AceNova said:

So, I want to create a plugin to add a wheel to the game to emulate a hovercraft.. The wheel should have the following properties:
...

This sounds a whole lot like the repulsors in KerbalFoundries2, using KSPWheel rather than the stock module.
Might be worth looking at adapting this code, and/or asking @Shadowmage re. tweaking it for your idea. Could save reinventing the wheel, so to speak. :P
 

Edited by steve_v
Link to comment
Share on other sites

14 hours ago, AceNova said:

I've never written a plugin before, aside from some basic part cfg editing

First get a basic setup going (see here).

 

14 hours ago, AceNova said:

Can anyone help me outline the steps I should take to implement this idea

The basic idea may be simply to add a force to the vessel that negate acceleration in a direction (eg: toward the planet surface, to negate gravity).

So lets call the acceleration you want to negate "A", and the acceleration you are using to negate it "B".

  • If you set "B" at every step to match "A", you have perfect hovering (gravity negated perfectly and instantly)
  • If you put an upper boundary on how much "B" can change per-second, you'll get a 'suspension-like' effect (vehicle can scrape the ground)
  • Lower "B" when vessel altitude is above target, and viceversa
  • Specify the above mentioned boundary in an appropriate thrust metic (eg: newtons)
  • Each simulation step, add some small random variance to the direction vector and re-normalize it, to get a 'slight instability' effect

Authoring the acceleration direction can be implicit, eg: you can simply use one axis of the part frame of reference.
So rotating the hovering engine in the VAB will allow for other acceleration-negation uses.

Consuming EC is trivial. Playing audio should be easy enough.

Note that this is like an engine module, but with automatic throttle and consuming mass-less fuel.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...