Question by
StrykerTorstein · Mar 20, 2016 at 01:11 PM ·
velocitybullet
Help with script for Bullet velocity
Hello! I'm trying to get a simple script where I can input the initial velocity of a bullet (in m/s) that decreases over time. Here's what i've got(doesen't work very well):
sing UnityEngine;
using System.Collections;
public class BulletMove : MonoBehaviour {
public float speed = 1f;
public float drag = 1f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
float velocity = ((speed * Time.deltaTime) -- (drag * Time.deltaTime));
transform.Translate (0, 0, velocity);
if (velocity -= 0) {
transform.Translate (0,0,0);
}
}
}
If anyone knows of a more simpler/easier way of doing this please do give some input! :D Thank you!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612072606im_/https://answers.unity.com/themes/thub/images/avi.jpg)