so i want to manipulate my rigidbody’s velocity manually. i’m doing it by just setting linear_velocity, which seems to be ‘working’ in that the rigidbody does end up moving like that. however, it also breaks the physics in weird and hard to explain ways.
the following issues happen if you set linear_velocity in any way, even with no change (here i’m doing linear_velocity *= 1 to debug, deleting this line fixes all issues.)
the biggest problem is that collision no longer effects the velocity. when the rigidbody hits something (like the ground) its y velocity should become 0 or some positive number if there us restitution. instead, the velocity stays at whatever amount it was at before. this is a big problem when there is gravity, because the downward velocity will keep building up when you are on the floor until it overcomes the collision sweep and you clip through the ground. another example of this behavior is when the rigidbody moves into a ramp or wedge. ordinarily this would redirect the velocity, giving you some upward speed if you move into an up ramp. instead, the rigidbody moves up the ramp because of collision but then stays at 0 y velocity and keeps moving straight.
the other weird issue is harder to describe, i don’t understand it completely, but something is messed up about forces. i have exactly one force on my rigidbody- gravity- and when you manipulate linear_velocity gravity doesn’t accumulate, it gets stuck at some really low fixed velocity, almost like there is friction? basically it doesn’t accelerate. if i add my own manual forces by adding to linear_velocity i can get acceleration to happen but it doesn’t seem to work ‘naturally’
does anyone know what’s going wrong here? i’m assuming for some reason when i manipulate this variable it gets like detached from the rigidbody somehow, and i know there are godot functions like add_force or something to that effect, but i would really like to have the fine control over the variable that manually setting velocity affords me.
:edit: okay i just checked if READING from velocity has the same issue and it does not. it’s just writing that breaks things, again even if you are not actually changing anything ie linear_velocity = linear_velocity