hey, I have a little problem with Quaternions.
i am shooting a little ball, and when that ball collides with the ground a flat sphere( circle ) should appear. Everything works just fine, but the rotation is wrong. I am using the LookRotation-function of the Quaternion, but it seems i don't fully understand what it does. (for example my level is a completely flat, so it should look exactly 90° upwards. But the rotation of the circle is x 76, y 74, z 1)
ATM my code looks like that:
i hope someone can help me =)
asked Jun 10, 2011 at 11:23 AM
I guess the problem is that you don't set the up-vector explicitly.
Therefore you call Quaternion.LookRotation like this:
The problem is that if contact.normal equals Vector3.up you get in trouble. The second parameter (the up-vector) specifies the rotation around the axis given in the first parameter. If the first parameter is Vector3.up you have to use Vector3.right or .forward as up-vector.
answered Jun 10, 2011 at 12:25 PM
if you just want it to look up, I think you can use.
answered Jun 10, 2011 at 11:47 AM