You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 19:41:11 +00:00
Added automatically set velocity when rigid is kinematic
This commit is contained in:
@@ -351,7 +351,7 @@ void RigidBodyBullet::set_space(SpaceBullet *p_space) {
|
||||
|
||||
void RigidBodyBullet::dispatch_callbacks() {
|
||||
/// The check isTransformChanged is necessary in order to call integrated forces only when the first transform is sent
|
||||
if ((btBody->isActive() || previousActiveState != btBody->isActive()) && force_integration_callback && isTransformChanged) {
|
||||
if ((btBody->isKinematicObject() || btBody->isActive() || previousActiveState != btBody->isActive()) && force_integration_callback && isTransformChanged) {
|
||||
|
||||
if (omit_forces_integration)
|
||||
btBody->clearForces();
|
||||
@@ -774,10 +774,13 @@ Vector3 RigidBodyBullet::get_angular_velocity() const {
|
||||
|
||||
void RigidBodyBullet::set_transform__bullet(const btTransform &p_global_transform) {
|
||||
if (mode == PhysicsServer::BODY_MODE_KINEMATIC) {
|
||||
if (space)
|
||||
btBody->setLinearVelocity((p_global_transform.getOrigin() - btBody->getWorldTransform().getOrigin()) / space->get_delta_time());
|
||||
// The kinematic use MotionState class
|
||||
godotMotionState->moveBody(p_global_transform);
|
||||
}
|
||||
btBody->setWorldTransform(p_global_transform);
|
||||
scratch();
|
||||
}
|
||||
|
||||
const btTransform &RigidBodyBullet::get_transform__bullet() const {
|
||||
|
||||
Reference in New Issue
Block a user