godotengine / godot

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

[GodotPhysics] Generic6DOFJoint angular motor doesn't work #54761

Open Saitodepaula opened 2 years ago

Saitodepaula commented 2 years ago

Godot version

3.4 stable official

System information

Windows 10, GLES 3 NVIDIA GeForce RTX 2060

Issue description

Generic 6DOF joints angular motors work fine with Bullet, but not with Godot Physics.

With Godot Physics, the joints keep rigid bodies attached, but doesn't make them spin.

Steps to reproduce

  1. Attach 2 ridig bodies with Generic 6DOF joints.
  2. Set the joints ANGULAR MOTORS to ENABLED and set a TARGET VELOCITY.
  3. Play the game with Bullet and with Godot Physics.

Minimal reproduction project

[6DOF_Minimal.zip](https://github.com/godotengine/godot/files/7497605/6DOF_Minimal.zip

https://user-images.githubusercontent.com/22160489/140757946-8bf48a18-f00f-4f19-a702-50a0716459c3.mp4

)

alex-karev commented 2 years ago

Have the same problem with angular spring. Everything works fine with Bullet, but not with GodotPhysics

Saitodepaula commented 2 years ago

I've just tested this same minimal project on Godot 4.0 Alpha 1, and the result was the same: the angular motor does not work.

ywaby commented 2 years ago

still not work with master, and linear motor also no work. version 3.5 is work fine.

Saitodepaula commented 2 years ago

still not work with master, and linear motor also no work. version 3.5 is work fine.

Did you managed to make angular and linear motor to work on 3.5?

I've just tested the minimal project from this issue on 3.5 beta 1, and with Godot Physics, it's not working.

ywaby commented 2 years ago

Well, I made a mistake. I only test under bullet engine. It not work under godot physic engine.

lucdevrx commented 1 year ago

I'm using Godot 3.4.3 (because I'm lazy), and I had similar issues.

I've been playing around with the vehicle setup by @Saitodepaula, and when I tried changing the physics to GodotPhysics, as soon as the wheels touched the ground it started spamming errors (so many the frame rates dropped to a crawl).

I removed all the scripts and everything else from my vehicle, so that I was just left with the nodes on their own, and the errors stopped. Then I changed only the linear limit and linear spring settings on the joints, just so I could see some bounciness, and it started spamming the errors again.

It seems to be only these two errors, but spammed constantly:

E 0:00:02.249   set_axis_angle: The axis Vector3 must be normalized.
  <C++ Error>   Condition "!p_axis.is_normalized()" is true.
  <C++ Source>  core/math/basis.cpp:956 @ set_axis_angle()
E 0:00:02.370   instance_set_transform: Condition "Math::is_nan(v.x)" is true.
  <C++ Source>  servers/visual/visual_server_scene.cpp:692 @ instance_set_transform()
richard-hajek commented 1 year ago

Can a warning be put in the editor? Something like "Angular motor of 6DOF not implemented"? I just spent 2 days trying to figure out, why doesn't my motor spin, I did not expect an engine issue

addmix commented 1 year ago

Tested in 4.1.1. Linear motor, linear spring, angular motor, and angular spring all do not function, only the limits. I think this should be a priority to fix.

This issue should probably also be added to the GodotPhysics 3D issues tracker #45333

LunarShadow01 commented 1 year ago

I'm also experiencing similar issues with the joint's motor when starting the scene with the engine enabled it will spin as long as it is completely free floating without resistance but when it reaches a complete stop it will never spin again no matter the parameters applied

I have not tested with the bullet engine

LunarShadow01 commented 1 year ago

Godot version 4.1 Update: after further investigation while looking at the remote properties of the running project i have noticed that when the RigidBody3D's angular velocity goes below a certain range the sleeping property would toggle on and from that point any attempt to get the motor spinning again failed turning off the can sleep property solves this issue and all angular motor functionality seems to be in order

I assume the RigidBody3D does not check whether a motor is attempting to apply forces to it and thus it stays in sleep

if anyone here is experiences the issue could you verify if this is the case for you or is there another cause

Edit: Additionally. the motors don't any significant torque or power (i don't know exactly what) they can barely rotate given light mass load with a 1x1 cube and a cylinder as a "wheel" the motor is barely able to move them when they have a mass of 0.3 kg each when on the ground: the motor will go up to angular momentum in the thousands but when they even are in contact with the ground (or even each other given the collision between them isn't disabled via the joint6 property) they will not go above 0.01 angular velocity on any axis

addmix commented 1 year ago

Turning off can_sleep on all bodies did not solve the issue for me, 4.1.1

LunarShadow01 commented 1 year ago

Turning off can_sleep on all bodies did not solve the issue for me, 4.1.1

Were you using it on the ground / touching the other rigidbody or floating. Like my edit mentions the joints are not able to exert any significant force