Jump to content

Firespitter propeller plane and helicopter parts v7.1 (May 5th) for KSP 1.0


Snjo

Recommended Posts

Snjo: Ah, I didn't see any error in the log (caught exception maybe? or not even that?) so I thought I should just try everything. Will fix.

Also, thanks so much for the nosecones--I didn't even realize you'd added them!

They let me make this pretty little thing (instead of, y'know, doing my work):

http://i.imgur.com/aVemIvCl.jpg

Hey man, get at me about the procedural control surface texture switching, i've got it dialed in on mine. I resorted to a hard cfg edit.

MODULE

{

name = FStextureSwitch

displayName = Psurf Colors

showListButton = true

moduleID = 8

switchableInFlight = true

debugMode = false

textures

{

name = ProceduralDynamics/Parts/Aero/procedural_ControlSurface_1/model000

name = ProceduralDynamics/Parts/Aero/procedural_ControlSurface_1/blacksurf

name = ProceduralDynamics/Parts/Aero/procedural_ControlSurface_1/bluesurf

name = ProceduralDynamics/Parts/Aero/procedural_ControlSurface_1/greensurf

name = ProceduralDynamics/Parts/Aero/procedural_ControlSurface_1/orangesurf

name = ProceduralDynamics/Parts/Aero/procedural_ControlSurface_1/redsurf

name = ProceduralDynamics/Parts/Aero/procedural_ControlSurface_1/slatesurf

name = ProceduralDynamics/Parts/Aero/procedural_ControlSurface_1/brightGreen

name = ProceduralDynamics/Parts/Aero/procedural_ControlSurface_1/lavenderPurple

name = ProceduralDynamics/Parts/Aero/procedural_ControlSurface_1/yellow

}

objects

{

name = model

name = obj_ctrlSrf

name = Armature

name = Root

name = Tip

name = Collider

name = Collider_001

}

}

change the textures { name = .....} to the name of your textures of course, just as they appear in the database btw (alt f12 -> database -> textures) and you might try and remove some of the objects affected, but these work perfect for me. I just dropped the textures into the folder alongside the originals as you can see.

Edited by Dirt_Merchant
Link to comment
Share on other sites

are the turboprops in the pre-release yet?

No, there's still some minor geometry work to do. After that I'll throw it in there using the default engine code, but the final version will need a better piece of code to respond properly.

Also, Dirt Merchant was all excited about finding some sweet sounds, so I'm looking forward to that.

Link to comment
Share on other sites

Snjo, I thought I remembered us working on a hovercraft part long ago. Did that not happen?

I'm fuzzy on the details, but yeah, there was this thing:

ulgd31V.png

It worked OK as long as you didn't try to go up hill at high speed, cause it would ram into the ground, and it needed to be hovering a bit higher than looked good to avoid terrain collisions...

If you have good ideas for keeping it JUST off the ground, I'm all ears.

Link to comment
Share on other sites

I'm fuzzy on the details, but yeah, there was this thing:

It worked OK as long as you didn't try to go up hill at high speed, cause it would ram into the ground, and it needed to be hovering a bit higher than looked good to avoid terrain collisions...

If you have good ideas for keeping it JUST off the ground, I'm all ears.

It would be nice to use this on water (have you tried already ?)

Why not a low thrust but quite large (0.625m diameter for ex) "engine" which just push the thing up, just enough to lift it only a few cms off the ground (thrust might be adjusted for a single mass only) like your "pusher" propeller.

Link to comment
Share on other sites

The issue isn't getting it off the ground, it's predicting a rise in the landscape and avoiding it in time when you are doing 50m/s straight forward. If the rise is 10m ahead, that gives the engines 1/5th of a second to react in time and push you up. In real life you could just vrush against the ground, but in KSP it would cause a collision with either destruction, a nasty bounce or a flip.

If you are flying higher you of course have more time to react, but it looks less fun.

Basically, you need something that has a shock absorption system like wheels, repulsing you when needed, but nice and floaty, and without the sideways friction.

If I knew how the wheel colliders (or any collider) keep you off the ground, I would be able to work something out, but I have no idea.

Edited by Snjo
Link to comment
Share on other sites

Cool! My thought was to use invisible spheres underneath on spring joints. Unfortunately, spring joints can only be made between separate rigidbodies. I'm going to guess that KSP does not support importing a Unity file with multiple rigidbodies, so it would have to be added later by scripting.

BTW, don't know when I could work on this... Trying to release my first game on Google Play soon.

Edited by Hooligan Labs
Link to comment
Share on other sites

Yes, probably better to write something like this...


// Width and length of the air cushion skirt
public float skirtWidth = 2f, skirtLength = 4f, spaceBetweenForces = 0.5f;
public float forceMax = 1f;

void FixedUpdate() {

// Check in all spots under the skirt
for (float wide = -1 * skirtWidth / 2; i <= skirtWidth / 2; wide += spaceBetweenForces) {
for (float long = -1 * skirtLength / 2; i <= skirtLength / 2; long += spaceBetweenForces) {

Vector3 downVector = transform.TransformDirection(Vector3.down); // Force out the bottom of the skirt
Vector3 worldForcePosition = transform.TransformPoint(new Vector3(long, 0, wide); // Where we are checking on the skirt
Vector3 pointGravity = FlightGlobals.getGeeForceAtPosition(worldForcePosition).normalized;
float airForce = 0;

// First check for water
if (vessel.mainBody.GetAltitude(worldForcePosition) < downVector.magnitude) airForce = Mathf.Clamp(Vector3.Dot(downVector, pointGravity) * forceMax, 0f, forceMax);
// If not, check for objects under the hovercraft, should work for everything but water
else if (Physics.Raycast(worldForcePosition , downVector, out hit)) airForce = forceMax - forceMax * hit.distance / downVector.magnitude;

rigidbody.AddForceAtPosition(downVector * airForce, worldForcePosition ); // Apply force at this point on the skirt away from the thing below

}
}

}

Details coming soon!

Edited in some more quick thoughts on the calculation

Edited by Hooligan Labs
Link to comment
Share on other sites

The easiest and sturdiest way to do it is to have pre placed transforms in the skirt part, one for each corner for instance.

You can see in the buoyancy code how it looks at a specific transform an applies force there. The trick is that there are four of these modules defined in for instance a boat hull. (Or a single point in something like the seaplane floats, cause they are added in multiples).

Each of these check the height of their assigned transform and applies force to the central rigidbody at that point. It's a pretty stable system.

In case ov hovercraft you just need to substitute altitude above the planet core for raycasting.

Link to comment
Share on other sites

Nice! Rotor wash when flying low looks awesome! Can't wait to have fun with that.

Out of curiosity, does that work if you point props in such a way that their thrust is directed at the ground?

Link to comment
Share on other sites

Nice! Rotor wash when flying low looks awesome! Can't wait to have fun with that.

Out of curiosity, does that work if you point props in such a way that their thrust is directed at the ground?

It could be added to any engine when it's done. Like a rocket :)

Link to comment
Share on other sites

The easiest and sturdiest way to do it is to have pre placed transforms in the skirt part, one for each corner for instance.

You can see in the buoyancy code how it looks at a specific transform an applies force there. The trick is that there are four of these modules defined in for instance a boat hull. (Or a single point in something like the seaplane floats, cause they are added in multiples).

Each of these check the height of their assigned transform and applies force to the central rigidbody at that point. It's a pretty stable system.

In case ov hovercraft you just need to substitute altitude above the planet core for raycasting.

Couldn't you use the surface distance? I know there are a couple mods that can measure the distance a part is from the surface, so... Wouldn't that fix the problem?

(I AM NOT A PROGRAMER)

Link to comment
Share on other sites

Couldn't you use the surface distance? I know there are a couple mods that can measure the distance a part is from the surface, so... Wouldn't that fix the problem?

(I AM NOT A PROGRAMER)

There are different ways of measuring surface distance. A readout in a mod will typically just do the math in one of many ways to get the vessel altitude. In this case though, shooting a ray towards the ground is more accurate, and can check at locations other than the center of your cockpit.

Regardless, finding the distance to ground isn't the tricky part. The challenge is predicting and reacting to changes in the landscape OR making an alternate system where bumping into the landscape is not an issue.

Link to comment
Share on other sites

The issue isn't getting it off the ground, it's predicting a rise in the landscape and avoiding it in time when you are doing 50m/s straight forward. If the rise is 10m ahead, that gives the engines 1/5th of a second to react in time and push you up. In real life you could just vrush against the ground, but in KSP it would cause a collision with either destruction, a nasty bounce or a flip.

If you are flying higher you of course have more time to react, but it looks less fun.

Basically, you need something that has a shock absorption system like wheels, repulsing you when needed, but nice and floaty, and without the sideways friction.

If I knew how the wheel colliders (or any collider) keep you off the ground, I would be able to work something out, but I have no idea.

I just think the same in some way, why not creating invisible wheels, their height define the hovering height (it can also be plug-in tuned), so we just show something going over the ground, the wheels doing the job of terrain following for you. The good thing is wheel don't have to be nice, as they are not shown :P any ugly model can work, it's make the job easier I guess (no polishing, texturing).

The trick is just to avoid to flip the hovercraft on turn and high slope like what could happen with small/narrow wheels.

Good job of the wash :) now it just need chopper to be more easy to control (balance issue are very critical here, more than typical VTOL)

Link to comment
Share on other sites

There are different ways of measuring surface distance. A readout in a mod will typically just do the math in one of many ways to get the vessel altitude. In this case though, shooting a ray towards the ground is more accurate, and can check at locations other than the center of your cockpit.

Regardless, finding the distance to ground isn't the tricky part. The challenge is predicting and reacting to changes in the landscape OR making an alternate system where bumping into the landscape is not an issue.

Is it possible to direct the ray cast diagonally at the ground so that it's projecting out/ahead a short distance?

Link to comment
Share on other sites

It works! Hahaahahahahaahhaaaa

No thanks to whoever made the old particle system in Unity! Expose your stuff to coders, jeeze!

That looks great! I never got the particle effects working just the way I wanted for the SQUID, so I know how hard this is to make it look that good.

Is it possible to direct the ray cast diagonally at the ground so that it's projecting out/ahead a short distance?

That was kind of what I was proposing with the code I put there. By raycasting and adding force in the direction of the part's local "down", you represent the force of the air coming out from the skirt. The part's down may be in any direction in the real world, so hopefully it would act just like a normal hovercraft.

If Snjo instead wanted to place transforms in the Unity editor and then reference them in his script, that could work just as well.

Link to comment
Share on other sites

That looks great! I never got the particle effects working just the way I wanted for the SQUID, so I know how hard this is to make it look that good.

The trick was fetching the array of all the particles (up to 200 in this case), ad each update, alter their positions, and then feeding that array back to the particle system.

So I'm doing mathy fun 10.000 times a second :) Luckily computers like that stuff.

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...