Moving the camera in a 3D space when camera is rotated (using Wikipedia Definition of 3D Projection) - camera

I wonder if someone could tell me how to make it possible to move a camera in a 3D space when
the camera is rotated.
I am working on my own 3D engine (nothing fancy) and I can move the camera forward backward left right up down, thats all good.
However when I rotate the camera, it doesnt move in the direction that the camera is directed to.
Here is a picture that should help you understand what I mean:
http://www.xaid.se/camrot.jpg
Does anybody know how to make this work?
(If you're interested in what I'm working on, visit this site)

i'm not sure if i really get what you mean, but your problem looks like you want to move along the direction of the camera instead along one (main-)axis?
therefore my solution would be to store a vector which keeps the direction the camera is looking, and update this vector everytime you rotate the camera. now you can use your direction vector for the forward movement. position + vector*stepsize.
hope that helps a little bit.

Related

Flickering material in Blender

I have some problems with a material on a large plane.
It is a simple plane with a texture on it. When I add a simple image texture, the material looks fine. But if I then make the camera move in an animation, the material is flickering and acting wierd in the horizon. I figure that it is because the image texture is getting very small when it's far away, so it renders it a little different on each frame. I can also see that if I disconnect the displacement it stops. So it's maybe a displacement problem and not and image problem.. I don't know :) But is there a way to make this stop. Maybe a way to make it render with less detail when it's far away? Or a way to make the image texture only appear when it's close to the camera? Or something else?
Best
Michael

How to make 3d text to appear on camera view in blender

I am creating a 3d text on blender2.8 but I am having a hard time trying to make it appear on the camera view.
I have tried rotating and scaling the camera but it doesn't help.
The camera object is the focal point for the final image, like in real life, if you want to get more in the picture you need to move the camera back or zoom out.
With the camera close -
With the camera far away -
To zoom out, you reduce the camera's focal length.

Unity2d; How to raise(lift) camera during game mode at a fixed y axis minimum

I may be making this harder than what it really is, but I am also pretty new to developing games. Currently I am making a practice scene to get back used to the unity engine as I have not had time to use it since last summer. My issue is that I can not figure out how to lift the camera in game mode. Notice my photo below, and how much of the "underground" is showing. I want to raise the camera to keep it at the very least a specific y axis value, so that I can make less of the ground visible, and more of the background visible. If I am over complicating this, please also let me know. Thank you
If main camera is still then just lift the camera in scene view you can see changes in game view.
Or if camera moves with respect to player then you have to use a script and attach it to camera and get a reference of player transform in the script and according to the player position change position of the camera. Add an offset value in y component of the camera.

XNA model translation is bizzarre

When using Matrix.CreateTranslation(x,y,z) I get bizarre results. I have tested using fixed values, one variable at a time and have determined the following:
When altering the X coordinates, the model moves from the top left corner to the bottom right corner.
When altering the Y coordinates, the model moves up and down as it should.
I do not plan to alter the Z coordinates, but because of the nature of my program I can't figure out exactly what it does.
I have my model drawn. Rotation works fine. I am performing my translations in the correct order (at least I think): scale * rotation * translation.
I think the problem lies in my camera settings, but I have no idea exactly what the problem is. I am trying to create a top-down-style RTS camera.
Here are my camera settings:
campos = new Vector3(5000.0F, 5000.0F, 5000.0F)
effect.View = Matrix.CreateLookAt(campos, Vector3.Down, Vector3.Up)
I can provide more information as needed.
The second argument of Matrix.CreateLookAt is not the direction the camera is facing, but the targeted point.
If you try to make the camera look down, use
Matrix.CreateLookAt(campos, campos + Vector3.Down, Vector3.Forward)
This will tell the camera to always look at the point one unit below the camera.
Your translation probably doesn't work well because the camera is not looking at the point you want it to, and therefore looks like the model is moving diagonally.

Three.js: Camera Collision on Terrain

How should I go about adding camera collision to a terrain in three.js.
The terrain is from 'mrdoob's three.js' examples and is randomly generated and I am currently converting it to height map.
I am thinking of implementing the collision as follows:
Create a 'box' object around the camera
If the box object is not touching the terrain, move the camera down.
If the box object IS touching the terrain, keep the Y axis of the camera.
How should I go about doing this?
The theory is that you send a ray from the location you are (camera position) straight down. You find the intersection point and based on the distance you decide what to do. Implementation wise I cannot help you but THREE.Ray should help you.