-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
camera rotation #93
Comments
maybe fake it, add every thing to a game object and rotate, scale,... just that one. import * as l from './littlejs.esm.js';
let fakeCam, obj;
const speed = 0.2;
const rotSpeed = 0.05;
function gameInit() {
fakeCam = new l.EngineObject();
obj = new l.EngineObject();
fakeCam.addChild(obj, l.vec2(2));
}
function gameUpdate() {
if (l.keyIsDown('KeyD')) fakeCam.pos.x -= speed;
else if (l.keyIsDown('KeyA')) fakeCam.pos.x += speed;
if (l.keyIsDown('KeyS')) fakeCam.pos.y += speed;
else if (l.keyIsDown('KeyW')) fakeCam.pos.y -= speed;
if (l.keyIsDown('KeyE')) fakeCam.angle += rotSpeed;
else if (l.keyIsDown('KeyQ')) fakeCam.angle -= rotSpeed;
}
function gameUpdatePost() {
}
function gameRender() {
}
function gameRenderPost() {
}
l.engineInit(gameInit, gameUpdate, gameUpdatePost, gameRender, gameRenderPost); |
That's an interesting workaround but I was thinking we could support setting a camera angle natively in the engine. This involves changing the webgl transformation matrix to include rotation as well the canvas 2d stuff. Also the functions screenToWorld, and worldToScreen will be updated. |
i need it |
there should be a way to set the camera rotation angle.
The text was updated successfully, but these errors were encountered: