0 votes

I am creating a water particle-based physics addon and including rigid body interaction. The problem however is that I have no idea how to take angular velocity into consideration as regular velocity. So if the body was rotating, it would not have an effect on the water particles but stop them in their tracks.

in Engine by (3,910 points)

1 Answer

0 votes

Hello!

I think you want the cross product function. When I wanted to sync a cube to the surface of a rotating asteroid, I did:

cube2.linear_velocity=-(cube2.global_transform.origin-asteroid.global_transform.origin).cross(asteroid.angular_velocity)

Then, the cube's velocity made it at rest relative to the rotating asteroid's surface.

by (56 points)

I'm talking about in 2D. Cross product doesn't exist in 2D.

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 Frequently asked questions and 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 [email protected] with your username.