Hot answers tagged

2

Do not use boxes for this kind of terrain. There are numerous problems that arise with using boxes, namely "catching" of objects on the intersections between the boxes. Box2D provides Edge Shape (line) primitives as well as a Chain Shape that far better suites your purpose. From the linked manual: // This a chain shape with isolated vertices b2Vec2 vs[4]; ...


2

NOTE: Edited because it was likely too verbose (source). A rotation matrix actually always defines an orthonormal basis. What this means is each column defines one of your original axes in its rotated state. For example, consider a simple rotation matrix around the z-axis (more on rotation matrices here). Let's say we plug in Pi / 2, in other words, we ...


1

Converting between a Quaternion (transform.rotation) and an Euler angle triplet is not possible the way you wrote it. See the API http://docs.unity3d.com/ScriptReference/Transform-rotation.html for the meaning of the transform.rotation property. If you want to double check or verify that your Euler angles are correct, you can convert them to a quaternion ...


1

My guess: At the bottom of MoveShip() you are setting the velocity to zero, if the player is at the boundary. As your code in Rotate() depends on the x and y components of the velocity (which is set to zero in the previous update, when at the boundary), the rotation will be set to Quaternion.Euler(0,0,0) in these occasions One way to solve this could be to ...



Only top voted, non community-wiki answers of a minimum length are eligible