- Home /
The question is answered, right answer was accepted
Rigidbody2d has zero velocity after simulated set to true
Hello there. I'm making something where you can drag around a UI object that has a rigibody2d attached. I'm setting simulated to false to turn off collisions with other objects while it's being dragged around. On dropping the object I am setting rigidbody.simulated to true. I want it to play a sound based on the rigidbody's velocity when it lands, but when it does, the velocity is zero. If it bounces off of another rigidbody before hitting the ground that corrects the problem. Am I using this incorrectly? Thanks!
I think you are using it correctly. $$anonymous$$ight need the script to tell more. I dont need the entire script just where the problem happens
If the only thing you want to do is disable collisions, wouldn't it be easier to just disable the collider when you start dragging the object? That way you should still have get the proper velocity from the Rigidbody.
Hope that helps!
Cheers,
~LegendBacon
Thanks for the suggestion. Disabling the collider and setting simulated to false seems to yield the same results in this case. I suppose there are pros and cons to both depending on how the object is used in the end though.
Answer by Romano · Jan 30, 2018 at 01:56 PM
Silly me, the velocity is of course 0 after it lands, because it's stopped. To use this method I'd have to get the velocity just before it collides I suppose.
Follow this Question
Related Questions
Keeping momentum with rigid bodies. 0 Answers
Rigidbody2D with interpolation lags while moving by velocity, how to solve the problem? 1 Answer
Issue with direction and rigibody2D 1 Answer
Displaying the y value score,Displaying the score of the Y value 1 Answer
Make object stay inside circle 1 Answer