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] Changing 3D gravity in BulletPhysics does not work as expected #35378

Open
Tracked by #45022
gyrosp opened this issue Jan 20, 2020 · 2 comments
Open
Tracked by #45022

[Bullet] Changing 3D gravity in BulletPhysics does not work as expected #35378

gyrosp opened this issue Jan 20, 2020 · 2 comments

Comments

@gyrosp
Copy link

gyrosp commented Jan 20, 2020

Godot version: 3.2 RC 2

OS/device including version: Windows 10 / PC

Issue description: I'm trying to make a game where the gravity changes during runtime. This does not work as expected.

  • Changing the gravity in _Ready() works fine
  • Changing the gravity in _Process(float delta) just slows the default gravity vector
  • Changing the gravity in _PhysicsProcess(float delta) freezes the gravity:
    public override void _Ready()
    {
		// Works as expected
        Vector3 lNewGravityVec3 = new Vector3(0,1,0);
        PhysicsServer.AreaSetParam(GetWorld().Space, PhysicsServer.AreaParameter.GravityVector, lNewGravityVec3);
    }
    public override void _Process(float delta)
    {
		// Just 'slows' the gravity
        Vector3 lNewGravityVec3 = new Vector3(0,1,0);
        //PhysicsServer.AreaSetParam(GetWorld().Space, PhysicsServer.AreaParameter.GravityVector, lNewGravityVec3);
    }
    public override void _PhysicsProcess(float delta) {
        // Freezes the gravity
		Vector3 lNewGravityVec3 = new Vector3(0,1,0);
        //PhysicsServer.AreaSetParam(GetWorld().Space, PhysicsServer.AreaParameter.GravityVector, lNewGravityVec3);
	}

Minimal reproduction project:
Physics Test.zip

@Xrayez
Copy link
Contributor

Xrayez commented Jan 20, 2020

Seems to be mono-specific, can't reproduce with GDScript.

@Zylann
Copy link
Contributor

Zylann commented Apr 10, 2020

I can reproduce this too in 3.2.1, following this QA question: https://godotengine.org/qa/66952/how-to-set-3d-physics-gravity-programatically

This only happens with Bullet. GodotPhysics works.

@Calinou Calinou changed the title Changing gravity does not work as expected Changing gravity in BulletPhysics does not work as expected Apr 10, 2020
@Calinou Calinou changed the title Changing gravity in BulletPhysics does not work as expected Changing 3D gravity in BulletPhysics does not work as expected Apr 10, 2020
@pouleyKetchoupp pouleyKetchoupp changed the title Changing 3D gravity in BulletPhysics does not work as expected [Bullet] Changing 3D gravity in BulletPhysics does not work as expected Jan 15, 2021
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

4 participants