#Projectile is floating instead of moving forward

1 messages · Page 1 of 1 (latest)

tough crag
#

So I was following this tutorial below (timestamped the exact part I'm at for convinence)
https://youtu.be/FbM4CkqtOuA?t=1175

In my example video below, despite me using velocity in the bullet projectile script the bullets just spawn in one place and floats in the air and if you look at the visual debug to the right it doesn't do what I want it to do. Not sure how to fix it, I triple checked everything and nothing is sticking out that's incorrect. Please someone help me understand

ThirdPersonShooterController Script
https://pastebin.com/Ht8WA7VT

BulletProjectile Script
https://pastebin.com/fRGkibjP

hoary egret
#

i can’t see the video, but i would first check that the bullet is a dynamic rigidbody

tough crag
#

Sure, and I'll send a mp4 of it

hoary egret
#

just screenshots plz lol

#

check the bullet rigidbody velocity during runtime

#

you can click on the dropdown to see what the rb’s current velocity looks like. I expect that vector to still be nonzero

#

screenshot the bullet’s inspector view, with rigidbody settings

tough crag
#

Will do

#

Like this?

#

The first screenshot is the actual prefab, this one is when it's spawned in the game

hoary egret
#

i see it doesn’t have the dropdown with info in 3D

#

so just add to the bullet script: void Update() => Debug.Log(rigidbody.velocity);

#

so it prints out velocity every frame. i need to know that velocity wasn’t set to zero

tough crag
#

Gotcha, just give me a moment gotta do something irl for 5 seconds

#

Sorry bout that, I'm back and gonna input the code now

#

I pasted in the code and nothing is showing up in the console command

#

!code

gray whaleBOT
tough crag
#
// public class BulletProjectile : MonoBehaviour {

    private Rigidbody bulletRigidbody;

    private void Awake() {
        bulletRigidbody = GetComponent<Rigidbody>();
    }

    private void Start() {
        float speed = 10f;
        bulletRigidbody.velocity = transform.forward * speed;
    }

    private void OnTriggerEnter(Collider other) {
       Destroy(gameObject);
    }

    void Update() => Debug.Log(GetComponent<Rigidbody>().velocity);

}
hoary egret
#

that’s why nothing shows on debug menu

tough crag
#

Ohh let me try that

#

It's working now omg