#Why does setting the rotation of a RigidBody2D every frame immobilize it, but only if it has Area2D?

1 messages · Page 1 of 1 (latest)

ornate lily
#

I'm working on a platformer game where you shoot projectiles at an arc, and they continuously face towards where they're going, and they are destroyed upon impacting a surface. To do this, I have the rotation set every frame accordingly, and I have an Area2D to detect when the projectile has hit something. However, when I added the Area2D, the projectiles stopped being able to move, although they still rotated correctly and had the correct velocity.

To test this principle, I made another scene with a test object that has all default settings and a simple script that only sets the rotation to 0 every frame. The problem replicates, and this object no longer falls down. Although, when I print the velocity continuously, the object does appear to be accelerating, it just never changes position.

#

player.gd and scone.gd are other scripts so far in the project, I didn't make an altogether separate project to test the issue, just a new scene

grave bolt
#

That is interesting, I don't know exactly why this happens, but I do know you shouldn't be setting the rotation of a RigidBody in _process/_physics_process and instead use _integrate_forces. However, from my testing this only occurred in _process. _physics_process was fine.