Tag Info

New answers tagged

1

Sorry for not posting a complete solution, but I have done something relatively similar to what you're doing. You may be able to adapt this idea into your program. What I did was output a video file into a Direct3D 9 (not 11) texture for rendering. I'm pretty sure it was possible to select a webcam as a video source instead of a video file, so in general ...


1

Turns out that the answer is more simple than I originally thought. // Calculate orthographic camera bounds float height = 2f * camera.orthographicSize; float width = height * camera.aspect;


2

I don't believe your second link's analysis works for a projection matrix FoV. In that link, the angle of the field of view is centered on the middle of the lens. The 'camera' with a perspective matrix is actually located behind the near plane. So the distance between the near plane and the far plane being used as one component of the atan calculation will ...


0

@Simon was pretty close. If you are trying to draw relative to the View that is Enabled you can use view_xview[view_current], view_yview[view_current]. For most situations you can get away with using view_xview[0] because most games do not utilize multiple views.


1

I actually think everything is okay! All I needed to clarify in my system is which direction is forwards, and I picked -z and that seems to have fixed my confusion. So it wasn't that my camera was facing the wrong direction, it was everything else that was facing the wrong direction! Sorry for the confusion!


0

If the player is looking directly at the camera we can use the following idea to find the direction the player should walk, based on the position of the camera. We have two vectors C: (camera.Transform.Forward) the direction the camera is looking at and P (player.Transform.Forward) the direction the player is looking at. By computing the acos of the dot ...


1

Though Fault's comment is correct, what I usually do is to store the rotation and translation and then recreate the view matrix when required. (Full article here). The gist of the idea is: (btw the type of camera you are creating is often referred to as an Arc-Ball camera.) public class ArcBallCamera { public ArcBallCamera(float aspectRation, ...


-1

I shall rephrase, the direction the player is facing is the forward direction, Therefor the camera should face forward (i.e the direction the player is facing), so the camera should be aimed at the player location always (unless you choose it to follow a different object like a vehicle) so there fore the camera facing point is player.location (This isn't ...


0

When developing games with Unity, you let the engine handle the screen resolution management. Check the Unity's Android settings and set the Default Orientation to Landscape. In case you need to zoom-in or zoom-out, change the size parameter for your Orthographic camera.


2

Add a flag to determine if the player has been stopped. At that point, stop setting the players position to the camera's, and instead some other input. public float speed; public test testing; bool stopped = false; // Use this for initialization void Start () { speed = 10f; testing = Camera.main.GetComponent<test>(); } // Update is called ...


0

I have achieved this by following this algorithm, Calculate the screen point of the 3D point under the mouse cursor (the point that needs to be on fixed location) before move the camera. (Say screen point as Pt2DScr and 3D point under mouse Pt3D1) Move camera along camera Z axis. That's mean zoom to center of the viewport. Calculate current 3D point which ...


0

You need to convert your cursor position into world position: Vector2 adjustedPosition = Vector2.Transform(touchCollection[0].Position, Matrix.Invert(camera.View)); Then your direction would be: direction = adjustedPosition - toolPos;


0

Anko and ashes999 were both right. (See their comments to my initial question) All my problems built upon my misunderstanding of spriteBatch.draw()-API. As soon as I got the right block size in place and adapted the camera to this new stuff all my problems were gone.



Top 50 recent answers are included