- Home /
Question by
Epic0007224 · Nov 18, 2017 at 07:56 AM ·
c#movementrigidbodyartificial intelligence
AI Movement with Rigidbody Physics?
I have a game where you basically drive a boat and shoot other enemy AI boats down. My code for the movement is this:
public float turnSpeed = 75f;
public float accelerationSpeed = 200f;
public Rigidbody rb;
void Update()
{
float h = Input.GetAxis("Horizontal");
float v = -Input.GetAxis("Vertical");
rb.AddTorque(0f, h * turnSpeed * Time.deltaTime, 0f);
rb.AddForce(transform.forward * v * accelerationSpeed * Time.deltaTime);
How can I make my AI move in the same way as this?
Comment
Your answer
Follow this Question
Related Questions
Making a bubble level (not a game but work tool) 1 Answer
GetButtonDown is unresponsive 0 Answers
RigidBody.MovePosition seems jerky in movement 0 Answers
Player isn't moving (AddForce) (Hook)(c#) 1 Answer
AI movement in D 0 Answers