godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.93k stars 21.15k forks source link

[Bullet] 3D StaticBody constant linear/angular velocity doesn't work when using Bullet #17531

Open eiszfuchs opened 6 years ago

eiszfuchs commented 6 years ago

Godot version: 3.0.2

Issue description:

While building my first game to test Godot out, I was reading about StaticBodys in the documentation and stumbled upon constant velocity:

[...] a constant linear or angular velocity can be set for the static body, so even if it doesn’t move, it affects other bodies as if it was moving [...]

It turns out, these properties do not have any effect at all with Bullet (the default 3D physics engine in Godot 3). With the engine set to GodotPhysics, these properties work as expected.

I need to investigate a bit further, but it seems the same thing is true for the thing the documentation calls "simulated motion mode".

Steps to reproduce:

Create a new scene with a StaticBody (e.g. a floor) and a RigidBody (e.g. a ball) and let the RigidBody drop on the StaticBody. Set constant_linear_velocity or constant_angular_velocity to any amount. The RigidBody will be launched when 3d/physics_engine="GodotPhysics", but won't do anything for any other setting.

Minimal reproduction project:

Standalone test scenes are in this repository: https://github.com/eiszfuchs/godot-test-scenes/blob/master/Scenes/ConstantLinearVelocity.tscn https://github.com/eiszfuchs/godot-test-scenes/blob/master/Scenes/ConstantAngularVelocity.tscn

bojidar-bg commented 6 years ago

CC @AndreaCatania.

eiszfuchs commented 6 years ago

I tried to build a test scene for the "simulated motion mode" mentioned in the documentation. From what I'm getting is that it's supposed to work when moving a StaticBody via script (such as animating a moving platform via GDScript).

I couldn't get it to work in either physics engine. I couldn't find a setting (because the documentation says it's something that has to be set active). In fact, if you Google godot "simulated motion mode", this ticket shows up, and the mention in the documentation shows up, but nothing else. There is something about it in the 2.1 documentation on KinematicBody2D, but that doesn't seem to be valid anymore in 3.0.

I'd really like that feature, too.

AndreaCatania commented 6 years ago

While building my first game to test Godot out, I was reading about StaticBodys in the documentation and stumbled upon constant velocity:

[...] a constant linear or angular velocity can be set for the static body, so even if it doesn’t move, it affects other bodies as if it was moving [...]

It turns out, these properties do not have any effect at all with Bullet (the default 3D physics engine in Godot 3). With the engine set to GodotPhysics, these properties work as expected.

Really strange, when I tested it, it was working... But thanks you for your report, I'll check it.

Also, the static body is not meant to be moved around, instead use the kinematic body and move it by changing its position, or use move_and_slide, etc...

Check the godot demos (platformer demo, if I don't go wrong (The one with pink box) ) how the platforms are moved using GDS

eon-s commented 5 years ago

This issue affects both Physics engines now, on 3.0.6 and 3.1b10.

rogeriodec commented 5 years ago

This issue affects both Physics engines now, on 3.0.6 and 3.1b10.

Here is a sample project in 3.1b11 with this issue: https://cdn.discordapp.com/attachments/212250894228652034/553366025760931844/3d_3.1.rar

realkotob commented 5 years ago

Still happens on latest master branch.

@AndreaCatania The issue is that KinematicBody cannot be used with Trimesh or Convex collision generated from imported Meshes (it gives an error in the console), so it is impossible to use with complex objects. 🤷‍♂

KoBeWi commented 3 years ago

Still valid in e9d12f9