Tag Info

New answers tagged

0

Just added transform.eulerAngles = transform.eulerAngles; into if (transform.eulerAngles==to.eulerAngles) { direction = ""; } and solved. I think Unitys Transform system is not so sensitive, I test it in log, even its rotation was approximately 88 on log, in inspector it was 90. So I add this code and it is done.


0

how do I translate ObjA's location into ObjB's local space? Get A's coordinates as a vector from the centre of B: Acb= (0.593,0,0) - (0,0,0) = (0.593,0,0) Make a (non-unit) quaternion from Object A's coordinates wrt B: Acq = w: 0, x: 0.593, y: 0, z: 0 Rotate it according to the inverse of B's orientation (Bq): Bq^-1 * Acq * Bq = (w: 1, x: 0, y: ...


0

Try decreasing the amount of the rotation, so change 5 to a lower number like 2, if that's still a lot decrease it even more.


3

I found the solution myself. Here's what I've done: I took the default forward rotation of the firingPoint object, and split it into it's parts - x, y, z, w. Then from these floats, I create a new Quaternion using the constructor method: float randomX = Random.Range(-0.1f, 0.1f); float randomY = Random.Range(-0.1f, 0.1f); float randomZ = ...



Top 50 recent answers are included