Skip to content

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

@gyrosp

Description

@gyrosp

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    For team assessment

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions