Jump to content

Hovercraft Problem


Recommended Posts

I created a hovercraft that works well on land but I'm having a problem with water. 

When you transition from land to water the craft maintains the attitude it had on land, this is because it's transitioning from raycast feedback to just plain addforce over water.

What I would like to do is level the craft over water but I can't seem to find a way to do it.

The video shows the land water transition.

Just looking for some suggestions or places to look.

Thanks

Video

Link to comment
Share on other sites

10 minutes ago, Gargamel said:

@uscespc, I'm a little unclear about what you are talking about?   Are you having issues flying a craft, or are you trying to write code to make a hovercraft mod?

 

It's all code, I've solved the thrust, turning, hover issues it's when you are hovering over land and cross over to water, water doesn't return raycasts which I use in a PID,  AddForceAtPosition  construct to hover.

Video2

Link to comment
Share on other sites

18 hours ago, sarbian said:

Have you tried to use a different layer for your raycast ? I am quite sure one layer actually works on water so you could combine it with the one you use for the ground. S

I tried them all 0-32 the only ones that returned hits were 10 Scaled Scenery and 15 Local Scenery. I use 15, 10's hit info was inconsistent.

Thanks for the suggestion.

Link to comment
Share on other sites

  • 2 weeks later...
On 11/14/2019 at 3:13 PM, flywlyx said:

I would suggest multiple ray cast to hover the vessel. When you are on water, use altitude replace ray cast, all other calculation stays the same.

Check the hover craft MOD I made previously.

https://github.com/flywlyx/Hover-Craft

Thank You

Looking at your code gave me a clue on how to solve the land to water transition. On land I use raycasts with a PID controller to adjust power to the hover nodes and this didn't work over water.

In your code I saw you use  height = FlightGlobals.getAltitudeAtPos(rcTransform.position); so once I detect the transition from land to water I use this value in the PID controller Error field.

Land: HForce = PIDController(TargetHeight, hit.distance)

Water:  HForce = PIDController(TargetHeight, height)

Works great, never thought it would be this simple.

Here is a video showing land to water and back.

Demo3

 

Link to comment
Share on other sites

  • 1 month later...
On 11/15/2019 at 7:54 PM, uscespc said:

Thank You

Looking at your code gave me a clue on how to solve the land to water transition. On land I use raycasts with a PID controller to adjust power to the hover nodes and this didn't work over water.

In your code I saw you use  height = FlightGlobals.getAltitudeAtPos(rcTransform.position); so once I detect the transition from land to water I use this value in the PID controller Error field.

Land: HForce = PIDController(TargetHeight, hit.distance)

Water:  HForce = PIDController(TargetHeight, height)

Works great, never thought it would be this simple.

Here is a video showing land to water and back.

Demo3

 

Is this going to be (or is it already) a released mod?

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