This is the function i used on the Bullet node which is a rigidbody.
#applycentralimpulse(globaltransform.basis.z * muzzlevelocity)
#lookat(transform.origin + velocity.normalized(), Vector3.UP)
#transform.origin += velocity * delta
I mixed and matched all different methods? i think theyre called, like integrateforces and physicsprocess with many different lines of code.
This is in the physicsprocess of the cars rigidbody.
var b = preload("res://scenes/Bullet.tscn").instance()
b.transform = $Position3D.global_transform
#b.velocity = b.transform.basis.z * b.muzzle_velocity
I have a dreidal and a fidget spinner with this code:
(really fun to run over in the car)
I started a few days ago, i feel like i managed to get to the gist of most everything up to this point. I would like the bullet to fly at a rigidbody hit it and fall down.
Cant figure it out. Ive done a lot of googling and such in the past few days to get this far lol (pain). The bullets either fly all over, float or hit the object and stay there kinda looking
like a bee hovering at a flower. Or a hummingbird.
My best guess would be that the function on the bullet is running constantly while the bullet after i spawn it in with the space bar so i would need to create a script
with the function on it and do a function call from the bullet to that script which only gets called once. the floating may have to do with editing the transform in the script
but i need to set the transform so it aims and goes the right way. Whatever i got stuck on the other day seems like a cakewalk compared to this lol. Oh im brand new to coding and gamedev.
talk to me like a 10 yr old