Help and ideas for decent physics of a row boat
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.
Just to make it even simpler.. the forces would be applied on mouse click. No need to think about when ores are in the water etc. .
Answer by nt314p · Aug 12, 2017 at 01:54 AM
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!
Thanks this is a nice place for me to continue from