Hi All,
I am designing the simulation in which I am coding for the Water Ship navigation which has the following things
- User can move the ship in the forward direction
- User can change the direction by rotating the wheel on the sheep in either direction
- User can change the speed of the ship.
If any one come across similar demo along with the source code, please forward the same to me.
Thanks
Are you looking for tips on how to write the code for this? Or are you just looking for completed source code?
If the former, perhaps you could describe the control interface in a bit more detail and tell us what part you’re unsure of. If the latter, you might try the Collaboration forum.
Hi,
Thanks for the reply. My control interface is as follow
User should able to change drive the ship using wheel.
User should be able to rotate the wheel in z axis using the mouse dragging action.
Entire ship will be rotated based on the wheel rotation.
User can also move the ship forward and right and left direction.
I made a simple part to move a boat (move forward, left, right) on water. It worked well with Unity 2.6. However, it does not work any more when I upgraded Unity to 3.1.
What should I change with the new version?
Thanks!
Dave
I used Skybox; added water (professional); added boat, attached script to boat for Unity 3.1:
var speed = 3.0;
var rotateSpeed = 3.0;
var bullitPrefab:Transform;
function Update()
{
var controller : CharacterController = GetComponent(CharacterController);
// rotate around y
transform.Rotate(0, Input.GetAxis(“Horizontal” )*rotateSpeed, 0);
//move forward/backword
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis(“Vertical”);
controller.SimpleMove(forward * curSpeed);
if(Input.GetButtonDown(“Jump”))
{
var bullit = Instantiate(bullitPrefab, GameObject.Find(“spawnPoint”).transform.position, Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward * 8000);
}
}
@script RequireComponent(CharacterController)