Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bullet] Area zero gravity with Bullet #40127

Open
Tracked by #45022
eberan opened this issue Jul 5, 2020 · 4 comments
Open
Tracked by #45022

[Bullet] Area zero gravity with Bullet #40127

eberan opened this issue Jul 5, 2020 · 4 comments

Comments

@eberan
Copy link

eberan commented Jul 5, 2020

Godot version:
Godot 3.2.2 Official, Standard 64bit (Windows)

OS/device including version:
Windows 10
GPU: Nvidia 1060m
Backend: GLES2

Issue description:
Short: RigidBody in Area with zero gravity override still has some initial (internal) force applied, while using Bullet but not Godot physics. Expected results are zero forces applied and RigidBody remains still. Potentially related to Issue #32776 or #35378.

Steps to reproduce:

  • Ensure Bullet physics is in use (default?), no other global physics modifications.
  • Create Scene with RigidBody entirely within an Area. The Area should use Replace Space Override and set gravity to zero (both vector and magnitude).
  • Run the scene.
  • The expectation is that no force is applied to RigidBody as it has always been within the Area with no gravity. Same results when creating an instance of the RigidBody after the scene is running (not in minimal project)
  • Change physics back-end to Godot and run Scene; expected results achieved (no movement)

Minimal reproduction project:
bzg.zip

@AndreaCatania
Copy link
Contributor

A solution to fully fix this, is to perform a collision check when the body enters the world.
I'm not a big fan on this idea, TBH, because the gain is little and the cost is huge.

Scripting side this issue can be avoided easily, so I want to think a bit more on this, to see if it worth or not fixing it. In the meanwhile I'm open to suggestion.

@eberan
Copy link
Author

eberan commented Jul 12, 2020

Thanks for the comments @AndreaCatania. Any chance you could give a few lines of example script/code that would manually add an object to an area? I'm just not seeing how to, yet.
Regarding the changes necessary to accomplish this by default, do you have any idea why it behaves differently with Godot physics in this regard?

@AndreaCatania
Copy link
Contributor

AndreaCatania commented Jul 20, 2020

The gravity is applied only the first frame so:

  • Your body could have gravity scale set to 0 the first frame, and you could switch it to 1 after it.
  • Another solution would be active the custom_integrator for the first frame.
  • Yet another solution could be make the rigid body to be kinematic the first frame.

So, you should do something that make sure to freeze the body the first frame

@mrjustaguy
Copy link
Contributor

Can Confirm that it is related to #32776 and the problem seems to be that it just doesn't update the needed area settings in stuff affected by the area, whereas Godot Physics does it just fine.

The issue I started as stated above was in regards to such issues with gravity.
One thing i did notice in a project i've started working on just a few days ago is that when Gravity Point is on, everything works as expected.
rotating the area (to change which way is supposed to attract the rigid body) by using a position3d as a gimbal, adding an area as a child and moving it by alot (-100 y axis) and adding a collision shape to the area and moving it to the exact opposite of the area to get it to an effective 0 y axis value in relation to the position3d gimbal used, when Gravity point is on, the rigid body goes to the area and correctly changes it's gravity according to the gimbal rotation (meaning the body is going to the position of the area node as it should)

Try doing something like that without Gravity point on in bullet and you will fail to change the axis of the gravity for any objects that are in at the time of the change in the gravity vector, however Godot phys will do it the way it should work in bullet too.

@pouleyKetchoupp pouleyKetchoupp changed the title Area zero gravity with Bullet [Bullet] Area zero gravity with Bullet Jan 15, 2021
@fabriceci fabriceci modified the milestones: 4.0, 3.x Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants