0 votes


First some code:

var rigid_body_node = kinematic_body_node.rigid_node_object
var org_node_loc = kinematic_body_node.global_transform
rigid_body_node.global_transform = org_pcl_loc
rigid_body_node.linear_velocity = Vector3.RIGHT * 2.1

The node on the PathFollow has an animation that tilts it. This code is run in the animationfinished signal handler. What I am doing is replacing a kinematic body with a rigid body when the animation is finished. Before this time i need the object to be kinematic so I can control it when it moves along with nodeon_PathFollow. After this time i need it to be rigid so the physics engine can take control.

It is practically working. The kinematic node is replaced with the rigid node (which is held as a var inside the kinematic node). The new rigid node is also sliding down the tilted node pretty much as expected. I still need to fiddle with the numbers.

But as you can see I try to apply some velocity to it just before I put it in the scene. This is to replicate the speed the kinematic node has as it's moving along the PathFollow. The 2.1 is just a rough estimate. From its own perspective, the kinematic node is not moving at all. But the node it's attached to is. But not with any kind of force. I use the unit_offset on the PathFollow (is there even any other way...).
So... (I would like to have shown a video, but I don't have the capability) at the exact moment I put the rigid body node into the scene it is supposed to move along its right axis (Vector3.RIGHT * 2.1), but it looks like there is just a single frame of, well, it looks like it's not moving for the slightest of time. Maybe one frame. Then it moves with the velocity given. It gives a very noticeable stutter. Naturally I want the animation to look seamless going from one node to the other.

I don't know the first thing about the physics engine, so maybe someone has any idea what could be causing this small stutter, and maybe how to mitigate it.

in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.