Quantcast
Channel: Answers by "gfoot"
Viewing all articles
Browse latest Browse all 95

Answer by gfoot

$
0
0
Physics is not performed relative to the parent - it all happens externally, then the world-space values for rigid body positions get put back into the objects. One option you have is to use constraints to constrain the child to the parent's axis. This will give a physically plausible result when the parent rotates while the child is already moving. Look them up if it sounds useful. You might also want to apply your forces relative to the parent, so instead of using Vector2(1, 0) you can transform it using the parent's transform, to get a new world-space vector that's not just along the world X axis. Vector2 worldVector = parent.transform.TransformVector(localVector); It really depends what you're trying to do, and actually I find myself doubting that you really want physics involved here at all. You may be better off just not using rigidbody2d at all.

Viewing all articles
Browse latest Browse all 95

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>