Quantcast
Channel: Questions in topic: "build"
Viewing all articles
Browse latest Browse all 4084

Velocity won't properly work in build, but works in editor

$
0
0
Hey! I have an issue where a magnetic field used to alter the users velocity only works in the editor and not in the build. The velocity used to move the character works as intended when built, however the character is almost not affected by the magnetic push nor pull. Here is a video showcasing my problem: [Magnet Problem][1] void PushObjects(Vector3 pos, Rigidbody2D rb) { float distance; _targetMovement.enabled = false; _deactivated = true; distance = (transform.position - pos).magnitude; rb.AddForce(new Vector2( ((transform.position.x - pos.x) / distance) * -(_pushForce + _chargeMod), ((transform.position.y - pos.y) / distance) * -(_pushForce + _chargeMod)), ForceMode2D.Impulse); } I am calling this void inside of a FixedUpdate, the _targetMovement is just a temporary fix to stop the characters movement whilst he is influenced by magnetic powers. I have tried debugging the values both in editor and build and the values are the same. If anyone has any idea what could be the problem, any and all help would be appreciated!! Thanks in advance. [1]: https://www.youtube.com/watch?v=OUeggYi2erk&feature=youtu.be

Viewing all articles
Browse latest Browse all 4084

Trending Articles



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