I am trying to recreate the physics of a row boat in terms of acceleration and movement. I have tried wheel coliders but have completely failed. I have tried applying impulse forces but none of the methods I have tried give me a satisfying ‘row’. Any ideas or direction would be greatly appreciated. I don’t want it to be super realistic but something that applies a curve force and then applies drag to it would be decent enough.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RowboatBehaviourScript : MonoBehaviour {
public Vector3 targetPos;
public float moveDist = -10f;
public float t = 0.1f; // closer to 1: more intense row
// closer to 0: less intense row
// Use this for initialization
void Start () {
targetPos = transform.position;
}
// Update is called once per frame
void Update () {
if (Input.GetMouseButtonUp(0)) {
targetPos = new Vector3(transform.position.x, transform.position.y, transform.position.z + moveDist); //moving the target position 10 units forward
}
transform.position = Vector3.Lerp (transform.position, targetPos, t);
}
}
Try this code out. It basically smoothly moves the object the script is attached to forward.
If you have any questions, just ask!