Yeah, I know, my last post is like 3 below this. Promise not to post a new thread for a week. But I’ve been working for an hour and a half straight and there’s no way I can figure this out.
Making an FPS game, making climbable walls, aligning the player to face the wall turning into a massive problem. After much hair pulling I decided to get down to the basics and see if I was having issues with quaternions. Which I was.
var normalHit = Quaternion.FromToRotation(Vector3.up, hit.normal);
stupidTest.rotation = normalHit
After searching the forums a bit, I found that this should make my transform, stupidTest, have the exact same rotation as normalHit, right? Well it’s not working!
So I eventually made a dummy object (stupidTest) that matches the rotation of an object I come into collision with (this was originally for my function that lets players climb ladders).
Here is the before (the dummy is the exact same object as the walls, just submerged in the ground halfway)
Okay, so when I collide (poke) with the wall, this wall should turn 45 degrees to the right…correct?
Well, no.
Notice that I have the debugger open. Using
Debug.Log(Quaternion.FromToRotation(Vector3.up, hit.normal));
I am displaying the rotation of the object I am colliding with as a quaternion. After I collide with the first object, (-0.5, 0.0, -0.5, 0.7) pops up. When I collide with the dummy object AFTER colliding with the first wall (and it has assumed the new rotation) I get the same thing!.
I don’t really get quaternions, but if they have the same rotation, are the same object, they should be at the exact same orientation, right?
Again, sorry for posting twice in one day, makes me feel like a ubar noob, but this was frustrating me to no end…any help would be great.[/i]