我创建了一个非常简单的场景,其中只有一个刚性体。
我的整个代码下面是:
extends RigidBody
func _ready():
self.apply_central_impulse(Vector3(1, 0, 0))
self.gravity_scale = 0
self.linear_damp = 0
self.friction = 0
func _integrate_forces(state):
print("v", self.linear_velocity)
唯一发生的事情是一开始就进行了单部力冲动。
我期望发生的事情是(在没有重力,抑制和摩擦的情况下)它将保持恒定的速度(因为没有其他力量对其作用)。
但是,我观察到的是线性_velocity不断变小。
IE输出是:
--- Debugging process started ---
Godot Engine v3.4.4.stable.official.419e713a2 - https://godotengine.org
OpenGL ES 3.0 Renderer: NVIDIA GeForce RTX 2070 SUPER/PCIe/SSE2
OpenGL ES Batching: ON
v(1, 0, 0)
v(0.998333, 0, 0)
v(0.996669, 0, 0)
v(0.995008, 0, 0)
v(0.99335, 0, 0)
v(0.991694, 0, 0)
v(0.990042, 0, 0)
v(0.988392, 0, 0)
v(0.986744, 0, 0)
v(0.9851, 0, 0)
是什么导致我的刚性体速度放慢?
PS从Godot Q& a htttps:htttps:// godotengine。 org/qa/133003/what-slow-slow-down-rigid body ,以哪个地点获得答案,我都会尝试记住更新另一个。
I have created a very simple scene with just a single RigidBody in it.
My whole code is below:
extends RigidBody
func _ready():
self.apply_central_impulse(Vector3(1, 0, 0))
self.gravity_scale = 0
self.linear_damp = 0
self.friction = 0
func _integrate_forces(state):
print("v", self.linear_velocity)
The only thing that happens is a single force impulse at the beginning.
What I expected to happen then was that (in absence of gravity, dampening, and friction) it will maintain constant speed (as no other forces act on it).
However what I am observing is linear_velocity continuously becoming smaller.
I.e. output is:
--- Debugging process started ---
Godot Engine v3.4.4.stable.official.419e713a2 - https://godotengine.org
OpenGL ES 3.0 Renderer: NVIDIA GeForce RTX 2070 SUPER/PCIe/SSE2
OpenGL ES Batching: ON
v(1, 0, 0)
v(0.998333, 0, 0)
v(0.996669, 0, 0)
v(0.995008, 0, 0)
v(0.99335, 0, 0)
v(0.991694, 0, 0)
v(0.990042, 0, 0)
v(0.988392, 0, 0)
v(0.986744, 0, 0)
v(0.9851, 0, 0)
What is causing my RigidBody to slow down?
P.S. that is cross posted from Godot Q&A https://godotengine.org/qa/133003/what-is-slowing-down-rigidbody, whichever place gets answer first I will try to remember to update the other one.
发布评论
评论(1)
项目设置中有线性潮湿配置 - >一般 - >物理 - > 3d - >默认线性潮湿。它被应用于您的
刚性
。如果将默认线性潮湿设置为零,则减慢效果会消失。这似乎也是子弹和戈多物理学之间的区别,因为切换到godotphysics也使降低效果消失了。
是的,这违背了文档,因为根据它,您必须设置一个线性潮湿为-1才能获取默认值。
因此,您可以将此错误考虑在 - 我已经看到了其他类型的虫子,其中godotphysics的作用为广告,但子弹(或它与Godot的整合)有一些怪癖。
编辑:实际上,似乎已经有关于子弹的错误和抑制打开的:
There is a linear damp configuration in Project Settings -> General -> Physics -> 3D -> Default linear damp. And it is being applied to your
RigidBody
. If you set the default linear damp to zero, the slowing down effect goes away.This also appears to be a difference between Bullet and GodotPhysics, since switching to GodotPhysics also makes the slowing down effect go away.
And yes, this goes against the documentation, since according to it you would have to set a linear damp of -1 to get the default one.
Thus, you can consider this a bug, feel free to open a bug report at https://github.com/godotengine/godot/issues - I have seen other bugs of the kind, where GodotPhysics works as advertised but Bullet (or its integration into Godot) has some quirks.
Edit: actually, there seem to be bugs about Bullet and dampening open already: