« first day (2 days earlier)    last day (14 days later) » 

9:34 AM
Yes it's finally working !
This is what i did :
void Update () {


if (Input.GetMouseButtonDown (0)) {

targetPosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);
targetDistance = Vector3.Distance(targetPosition, transform.position);
moving = true;

} else if (Input.GetMouseButtonDown (1)) {
moving = false;
}


if (moving) {

turnSpeed = 0.010f * targetDistance;
moveSpeed = 0.1f * targetDistance;

transform.Translate (transform.up * moveSpeed * Time.deltaTime);

var newRotation = Quaternion.LookRotation (transform.position - targetPosition, Vector3.forward);
I used Translate instead of rigidbody
for the force part
Now i still need to find the right math calculation to do a nice rotation/movement
with
turnSpeed = 0.010f * targetDistance;
moveSpeed = 0.1f * targetDistance;
watch until the end haha
targetDistance is equal to aproximatively 13.0 when i click
 
10:15 AM
Ok finally i went back with the rigidbody and addforce (for the moving part)
this is my final script and i think it's good enough, what do you think ?
--
using UnityEngine;
using System.Collections;

public class BoatController : MonoBehaviour {

public bool moving = false;

private Vector3 targetPosition;
private Vector3 iniTransformPosition;

private float targetDistance;

private float turnSpeed;
private float moveSpeed;

void Start() {

}

void Update () {


if (Input.GetMouseButtonDown (0)) {

targetPosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);
targetDistance = Vector3.Distance(targetPosition, transform.position);
iniTransformPosition = transform.position;
--
Btw the problem with the rigidbody not stopping the movement was that it was keep adding force. I fixed it by setting a linear drag on the rigid body :)
 

« first day (2 days earlier)    last day (14 days later) »