0 votes

This is the function i used on the Bullet node which is a rigidbody.

func ready(delta):
if Input.isactionjustpressed("space"):
impulse(globaltransform.origin, Vector3.UP)
centralimpulse(globaltransform.basis.z * muzzlevelocity)
at(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.

if Input.is_action_just_pressed("space"):
    var b = preload("res://scenes/Bullet.tscn").instance()
    apply_impulse(global_transform.origin, Vector3.UP)
    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:

func physicsprocess(delta):

(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

Godot version 3.3
in Engine by (12 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.