Tag Info

New answers tagged

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.


1

(coincidentally I just wrote about this topic for my book. That chapter should be released next week; here's a brief summary) There are two primary steps to what you're trying to do: 1) Determine which direction to face 2) Rotate the player to face that direction The first task is handled via transforming the direction vector from camera-space to ...


0

Code provided by Katherine Rix: // Position camera to follow behind player's head. private void Follow(){ // orientation as an angle when projected onto the XZ plane // this functionality is modularise into a separate method because // I use it elsewhere float playerAngle = AngleOnXZPlane (player); float cameraAngle = AngleOnXZPlane ...


1

Assuming you are dealing with additive operations (i.e. rotation translation order is important). Generally you would want to update your Camera matrix in this order: Take identity matrix. Translate to FocalPoint Rotate to look in to the right direction Translate away from the FocalPoint by the DistanceFromFocal Same works with any Object that you want ...


0

This is a general explanation answer, you'll have to check with the code yourself. Perspective projection looks like this from above: Near clipping plane is what you see on your screen. Now see that the farther you get from it, the more you need to move the object to have it in the same position on the screen. For example take Blue point, it got moved ...


3

I don't know which is the specific error in your case, but at least from my experience, I'd use quaternion instead. You can just lerp between your current camera rotation and the desired one. Something like: transform.rotation = Quaternion.Lerp(transform.rotation, player.transform.rotation,Time.deltaTime * speed); In general quaternions offer a simple and ...


1

Not sure whats going on here. The whole point of vector is to convert the mouse location into a 3d point in front of the camera. Setting Z to camera.position.z when the frame of reference is currently focused on the camera (camera is 0,0,0) and then unprojecting that value into world space in particular makes no sense. var vectorx = (event.clientX / ...


0

First, the technical stuff that probably goes without saying, but... Camera very low to ground (TPPOV (Tiny Player Point Of View)) Player movement speed scaled down Second, the art stuff, that probably is what you're missing. This translates into... Brand new textures are required that show in fact what something looks like very close up. It has to ...


1

You need to add details to show the scale of the world. In terms of rendering, there's no difference between a tiny person in a normal room and a normal person in a large room. If there's any fog, you should decrease the distance for it so as to make the space look larger. It could also be the height of the ceiling in the room relative to the player height, ...


0

It's not quite the same, but I implemented something similar at a game jam. The game had players moving on a small circular level, wrapped around when the player reached an 'x' position of pi. Rendering was easy because we just rendered everything and then rotated an offset camera to track what was going on. You could implement something similar, as has been ...


5

I assume this is because in these cases the grid lines are not exactly on screen pixels, but somewhere in between. Is this correct? Yes, this is correct. The camera in LibGDX is based on a vector, which is made out of floats. When your camera is in between pixels (like at (1.2f, 63.5f)), then you will start to see that blur you mention because the ...



Top 50 recent answers are included