- Home /
Question by
Awanonimik · Aug 04, 2017 at 01:04 PM ·
2d2d-platformer2d-physics
Determining 2D Velocity in a specific direction?
I'm trying to get a script to Destroy(this)
if it's not moving at speed along the x coordinate.
Comment
Answer by · Aug 04, 2017 at 01:28 PM
If you are using Rigidbody you can watch the velocity in the x axis https://docs.unity3d.com/ScriptReference/Rigidbody2D-velocity.html
If you are not, you can check the position in the last frame or second and then compare it to the current position.
Your answer
![](https://koobas.hobune.stream/wayback/20220612131927im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Softbody physics with 2D sprites 1 Answer
Jumping from special jump orb 1 Answer