Game is choppy/freezes when using mouse to fly[SOLVED]

mojoyup1528mojoyup1528 Posts: 6Member
edited April 2 in 3D

I made a helicopter and when I move it in the air, the game seems to freeze until I stop moving the mouse again. I have a tank that when I control the top, does not stop the frames, using similar control methods.

Here is a video:

Ill post more info as needed.

Comments

  • zonezone Posts: 5Member
    edited April 2

    I'm new with Godot, so please take what I say with a grain of salt.

    Maybe the issue is changing the rotation_degrees in _input, instead of applying some force on the heli. But only if $"." is same as self. (It's not clear what that means as I haven't seen a description on this in the documentation yet.) I see that you use $".", then use self, and sometimes you just directly access things without self. What is the difference?

  • mojoyup1528mojoyup1528 Posts: 6Member
    edited April 2

    No worries, I am new also. Only a week in :P Yeah I was thinking integrated forces but ignored it because it controlled it at least :P.

    Yes, $' . ' denotes the scripts parent or "self". The $ is an easy way to get nodes inside the scripts parent, so just the . basically means parent :).

    BUT..>BUT> I will experiment with using "self" instead also to test just in case! TY for the help Ill try these out now and let you all know if that helps :) TY MUCH!

    UPDATE: So, since I cant use integrated physics in the _input section, I assigned a variable for mouse detection and said if that variable is true, then in the integrated_forces section I added add_force for the variable's relative movement. It makes it smooth :) I just need to figure out how to convert it to correct movements and 3D, since its mouse coordinates :) Thank you for the help so far :)

    UPDATE FINAL: Fixed :) I created variables for both relative mouseX and mouseY coordinates based on the last position so it resets everytime I stop moving the mouse. Then, I applied variables in the integrated_forces states to get the local origin of the main body and then when the mouse moves, the torque is added as a differential of each axis to the proper body rotation and BOOM :) Flies like a smooth charm now. I flew great before but now its not choppy so SOLVED! Here is a video of the new physics of the heli :)
    HELICOPTER PHYSICS IN GODOT!

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file