Tag Info

New answers tagged

0

Thank you all but I found an other way to do that. I created (or rather copied form this schema) a rotation matrix RotateMAT[16]: #define OGLToRadian(degre) ((degre) * (M_PI / 180.0f)) //... GLvoid ROT(float x, float y, float z) { const float cosA = cosf(OGLToRadian(GLrotate_y)); const float sinA = sinf(OGLToRadian(GLrotate_y)); float RotateMAT[16] = ...


2

OpenGL 1.x's built-in matrix operations are notoriously slow, and may even cause pipeline flushes in some cases. To gain performance, translate your gl matrix operations to client-side code (there are several solutions, http://glm.g-truc.net/0.9.5/index.html and http://cmldev.net/ being popular ones). If you already have a lot of code, you can easily write ...


2

When measuring performance, use frame times, rather than FPS. In your case: 1000 ms / 80 FPS => 12.5 msec/frame 1000 ms / 100 FPS => 10.0 msec/frame These are very even FPS numbers, which makes me suspect that they are tied to the display vsync. Have you tried disabling vsync (with a call like eglSwapInterval, or setting the Direct3D swap interval? ...


0

Finally, I have found an ultimate answer for my question. All I had to do it to use rotation from Euler angles instead of rotating around an axis. Working code below: Inside camera class: rotateCamera: function(radX, radY) { this.pitch += radY; // Prevent camera from flipping upside-down (constrained by vertical "plane") this.pitch = ...


0

You cannot use transform.Rotate because that will always rotate relative to whichever direction is currently facing. What you want to use instead is Transform.eulerAngles which will explicitly set a rotation despite whatever the current rotation is: transform.eulerAngles = new Vector3(0f, yAngleRotation, 0f); Each swipe direction would have a different ...


0

This could be related to the 4.1, 4.2 and 4.3 updates when they added 2D support. Objects can be defaulted to an average pivot point of itself and child objects instead of the specific pivot of the item selected. There is a setting you can change on the toolbar to show you which pivot you currently have displayed. This affects what the pivot point is for ...


3

Simple Solution If you want the body to instantly rotate just call Body::setTransform and pass the current position and the desired angle, don't bother applying torques or anything. The function call could be something like this: body.setTransform(body.getPosition(),myDesiredAngle); Physics Solution If you want the player body to interact with bodies ...



Top 50 recent answers are included