Quantcast
Channel: Latest Questions by Wrymnn
Viewing all articles
Browse latest Browse all 131

Change the easy script for better performance

$
0
0
Hi, I have 200+ objects and I call this script in update function. This decreases my performance a lot. Is there a way how to write it better? I am in 2D. void rotateObject(Vector3 rotationTarget, int angleDifference) { Vector3 targetVector = rotationTarget - myTransform.position; float angle = Mathf.Atan2(targetVector.y, targetVector.x) * Mathf.Rad2Deg - angleDifference; q = Quaternion.AngleAxis(angle, Vector3.forward); myTransform.rotation = Quaternion.Slerp(myTransform.rotation, q, Time.deltaTime * myRotationSpeed); }

Viewing all articles
Browse latest Browse all 131

Trending Articles



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