how do u apply a force from a given point to all directions to rigiddynamicbodies3D without using raycasts?

Yeah, you have to find out which rigidbodies are close enough to be affected. Maybe a circular area and find overlapping bodies. Then apply an impulse in the direction from the point to the body. I haven't tried it or anything. That's what I think I would try.

  • DJM replied to this.

    fire7side yes i want to find all rigidbodies within a sphere and apply impulse force.
    in unity i could use 'physics.overlapsphere' to find the bodies
    i was wondering how to code that in godot

    I think you would use an Area3D for this.

    You can create an Area3D with a sphere collision mesh. Leave it on the tree somewhere and just hide/disable it. Then when you need it (for example, if a grenade goes off), move it to the grenade position then have it check for overlapping bodies. The function is called get_overlapping_bodies().

    https://docs.godotengine.org/en/latest/classes/class_area3d.html

    Then, with the list that it returns, you can call the apply_impulse() function and pass in the center of the sphere.

    • DJM replied to this.

      TwistedTwigleg tnx for the example, exactly what i needed
      only these lines give error, the rest i could convert to godot4 api

      collision_layer = 0
      collision_mask  = 0
      mode = RigidBody.MODE_STATIC

        DJM hmm, I’m not sure. It looks like the collision layer and mask are still properties: https://docs.godotengine.org/en/latest/classes/class_collisionobject3d.html#class-collisionobject3d

        For the physics mode, I think you need to use the freeze mode property: https://docs.godotengine.org/en/latest/classes/class_rigiddynamicbody3d.html#class-rigiddynamicbody3d-property-freeze-mode

        I am not totally sure though, I have not used Godot 4.0 in roughly a year so I’m not 100% sure it is the equivalent.

        • DJM replied to this.

          TwistedTwigleg
          im probably getting the error cause in your tutorial u ve set up your custom vr rigidbody.
          wich is what ive removed. i need to pass something before '.collision_layer' etc

          Wasn't there a change to PhysicsBody in godot 4? Again, I haven't yet invested much time in the development version.