Help|Ship Script

Hey Guy’s.
I really really need Shipt Script.
I built one but it’s not very good and i want to get Ship Script to see what i need to fix in my script.
So…
Somebody have a script or project of Ship Movement?
TNX for helping.

Here’s one: http://www.unifycommunity.com/wiki/index.php?title=ShipControls

Okay TNX.
But another question:
?How I script that the ship will bo on the water?

Oh, that kind of ship. You could adapt that ship script to work with the new Water3 or Community ocean script by removing the line that controls “hover” and then use one of the buoyancy scripts to control the vertical movement of the ship (ie. “bobbing” movement).

I have Water3,
What I need to do?

I have Water3,
What I need to do?

You could probably fake floating by using a buoyancy script (I suppose they already exist) or just writing up your own that modifies the ship’s position and rotation to look like its floating.

FizixMan,
Can You Give Me An Expline\Explane?
TNX.

http://forum.unity3d.com/threads/31671-floating-a-object-on-water

http://www.google.com/search?btnG=1&pws=0&q=unity3d+buoyancy

both of the links don’t work :(.

Sure they work. I just opened them.

What?

They work fine here as well. In what way are they not working for you?

Perhaps he means he couldn’t find a usable solution with those links.

Okay FizixMan,
You halep me (Again).
but one more question:
I have that script:(It’s little part from the full script):

I try to make “Get In” and “Get Out” from Boat.
But It’s don’t work…
I doesn’t understand why It’s not working…

UP.

I think you are confused about what you posted. You basically posted a list of things you turned on and off. What you want to do is transfer control from one object to another.

So assuming that you have a character controller which controls the person and a ship controller which controls the boat:

In a game sense, you want the person to be able to walk up to the boat, press a button then start controlling the boat.

In a script sense, you want to check to see if the person is near and possibly facing the boat when he presses the key to control the boat. Next, you want to disable the player, and then set the boat up to be controlled. To do this, you need a combination of 3 basic scripts. A character controller script, a boat controller script and a camera controller script.

Character controller: is something like this:

var boat : Transform; // this can be preset, or you can use script to "find" boats.

if(Vector3.Distance(transform.position, boat.position) < 10.0  Input.GetKeyDown("e")){
// disable the person...
transform.enabled=false;
// enable the boat as a player
boat.gameObject.GetComponent("Boat").isAI=false;
boat.gameObject.GetComponent("Boat").isPlayer=true;
boat.gameObject.GetComponent("Boat").controller = transform; // set the boats captain to this object
Camera.main.gameObject.GetComponent("SmoothFollow").target = boat; // make the camera look at the boat
}
var isPlayer : boolean = false;
var isAI : boolean = false;
var power : float = 100.0;
var maxSteer : float = 15.0;
private var throttle = 0.0;
private var steer = 0.0;
private var controller : Transform; // defines who is controlling the boat.

function Update(){
// define the throttle and steering as if the nothing is controlling it
throttle=0.0;
steer=0.0;
if(isPlayer){
throttle = Input.GetAxis("Verticle") * power;
steer = Input.GetAxis("Horizontal") * maxSteer; // this isnt the best way.. ;)


// test to see if we are getting out of the boat:
if(Vector3.Distance(transform.position, boat.position) < 10.0  Input.GetKeyDown("e")){
// enable the person...
controller.enabled=true;
controller.position = transform.TransformDirection(Vector3.right * 10); // get out 10 units to the side.
Camera.main.gameObject.GetComponent("SmoothFollow").target = controller; // make the camera look at the player

// disable the boat as a player
isAI=false;
isPlayer=false;
}
}
// AI is set in an AI script so you don't set it here.
}

The camera script is only referenced in the player controller.

I posted list of things that need to start when I click on “F”.
But the problem is that they don’t work…

Did you try adding debug logs to see if the components are even being called in the script?

Add a few lines like:

Debug.Log("Speedo");

Add them to the Update() function to see if your components are being set.

http://forum.unity3d.com/threads/31671-floating-a-object-on-water

I have that script…
I using the boat sript to help me for my own boat script.
The problem is taht in my game the boad doesn’t move…