Is apply_torque_impulse missing in GoDot 3.0.2 ?

GarromOrcShamanGarromOrcShaman Posts: 122Member

Hi. According to this Docs page there is function called "apply_torque_impulse" on RigidBody.I trying to use it like this

func _input(event):
    if event.is_action("ui_up"):
        var v3 = -cam.global_transform.basis.z.normalized()
        v3.y = 0
        self.apply_torque_impulse (v3)

but every time i try it it looks like this :

Is function missing or i using it wrong way? Is there any other way how to apply physical rotation to ball-shaped RigidBody ?
Thanks.
-Garrom

Tagged:

Tags :

Answers

  • Ace DragonAce Dragon Posts: 131Member
    edited April 16 Answer ✓

    There's a separate function you need to define called _integrate_forces(body), anything that involves forces and impulses must be placed under it.

    To keep the input stuff under the event function, you can simply define the value of a variable (like you have) and use that variable to set the torque impulse.

  • DanicanoDanicano Posts: 7Member

    I've put my code in the _integrate_forces but still, the apply_torque_impule method is not available. apply_impulse is available but apply_torque_impulse is not!!!!

  • GarromOrcShamanGarromOrcShaman Posts: 122Member
    Answer ✓

    @Danicano said:
    I've put my code in the _integrate_forces but still, the apply_torque_impule method is not available. apply_impulse is available but apply_torque_impulse is not!!!!

    Hi. If you use func _integrate_forces(state): you need to call state.apply_torque_impulse(amount) because function is contained in state. You using _integrate_forces(state) only to have acess to state

  • DanicanoDanicano Posts: 7Member

    Awesome. Thank you very much for helping ignorants to learn a bit more!!!!!

  • GarromOrcShamanGarromOrcShaman Posts: 122Member

    @Danicano said:
    Awesome. Thank you very much for helping ignorants to learn a bit more!!!!!

    You are not an ignorant, it wasn't mentioned anywhere on page. There is no way how you could known it. I have done same mistake first time but i looked at docs (there is an code example including _integrate_forces(state)). Glad to help.

  • DanicanoDanicano Posts: 7Member
    edited May 30

    OK. Now the problem is when the rigidbody is sleeping (stops moving), the input command does nothing!!!!

  • GarromOrcShamanGarromOrcShaman Posts: 122Member

    @Danicano said:
    OK. Now the problem is when the rigidbody is sleeping (stops moving), the input command does nothing!!!!

    Yes, i know, I had same problem. Just select node, look through settings and disable "Can Sleep"

  • DanicanoDanicano Posts: 7Member

    Thanks!!!!

  • GarromOrcShamanGarromOrcShaman Posts: 122Member

    @Danicano said:
    Thanks!!!!

    No problem

Sign In or Register to comment.