0 votes

My project link

https://imgur.com/a/68E79Jx (this is what i want)

https://imgur.com/a/uJttkIA (this is how it happens)

extends KinematicBody

var speed = 20.0

var velocity = Vector3(0,0,0)
const SPEED = 5
const ROTATION = 3
const GRAVITY = 10
const JUMP = 500
var roketHiziUP = 10
onready var roket = $Cube003

func _ready():

func physicsprocess(delta):

if Input.is_action_pressed("ui_up"):
    velocity.y += GRAVITY * delta
    velocity = move_and_slide(velocity, Vector3.UP)
elif Input.is_action_pressed("ui_right"):

elif Input.is_action_pressed("ui_left"):

elif Input.is_action_pressed("ui_down"):

in Engine by (12 points)

I'm not very good with 3D but, but I think you want to have velocity going forward which is Vector3(0,0,-1) or Vector3.FORWARD. The way your code is, right now, it looks like you're only using the y-axis (up/down) for both gravity and direction of movement. So, redefining your velocity variable at the beginning and maybe the moveandslide vector at the end should make it better.

The gravity is pushing down and the -roketHiziUP pushing up... surprised it moves at all... So, maybe using the Vector3 constants would make it more clear:


‚óŹ FORWARD = Vector3( 0, 0, -1 )
Forward unit vector. Represents the local direction of forward, and the global direction of north.

1 Answer

0 votes

First of all, You should create your sprites aligned to any of the main axis. I mean image of your rocket should be completely vertical or horizontal.
Now You can get the direction rocket object is facing by getting its Transform.basis.x or y.
It will always return the vector object is facing, no matter the current rotation.

by (7,925 points)
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 Frequently asked questions and 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 [email protected] with your username.