The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

Not Works

func _integrate_forces(state):
if Input.is_action_pressed("ui_up"):

But it Works in

func _physics_process(delta):
if Input.is_action_pressed("ui_up"):
Godot version 3.4
in Engine by (37 points)
edited by

Have you tried just having the print function and no input first? What kind of node is it attached too? Integrate forces exist only for nodes extending rigid physics bodies. And its purpose is only for adding forces to the body.

Also this process wont be called if a rigid body goes to sleep you will need to keep the body awake by creating a collision, applying a force to it, or by disabling the can_sleep property.

1 Answer

0 votes
Best answer

Well as you seem to have ignored my comments with questions in I will simply add it here. You wont get an answer as you havent included any information here to allow anyone to determine what is going wrong but it is likely one of the below;

  1. The function is being called but the action button isnt being pressed when it is called
    Test: Remove the if function and just have a print to check

  2. The function is not on the correct node type
    Test: Try adding it to a rigidbody node

  3. The node is asleep when the call should happen
    Test: Disable the can_sleep property.

by (3,328 points)
selected by

Thanks your third solution is working

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.