Tag Info

New answers tagged

1

A simple solution would be to create and empty object( Camera container ) that follows the player and have the camera as a child. You can animated the shake independently however you want with the camera gameobject as long as it's a child of the container. -- Container Object (Follow player) └ Camera Object ( do animation )


0

In neutral position you have defined forward to be the positive Z vector (0, 0, 1). There are two vectors perpendicular to that vector (if we ignore sign), up (0, 1, 0) and left (1, 0, 0). The easiest thing would be to create all three vectors and to apply a matrix transformation to find the left, up, and forward vector in 'camera space'. Matrix transform ...


0

I would say to make each chunk continuous. Don't reset the world co-ords. As the old chunk scrolls off (into fog etc) write it to file or store to memory. New chunks scrolling in would do so only under fog (way at screen edge). Let your x,y, z go to 2000000000 both ways that's more than large enough for anyone.


0

You won't get away on this one with an easy answer. The raycast method is completely flawed. Its the same as calling the object "one pixel" wide and checking if this pixel is visible or not. Unity uses a precalculated visibility matrix, composed with regular sectors of your world, and a quadratic ray cast test. Which has the same flaws but you don't need to ...


2

This indeed should be very simple, so I suspect you may have gotten some details wrong. The overall goal is to match up the center of the camera with the midpoint of the players. As you've found though, those values aren't immediately available to you, so you need to work them out. What you might have are (leaving out the Y axis stuff since we don't need ...


2

Depending on your exact needs, another possible solution would be to do a test render where you set different objects to different colors and then check for that color in the test render. However this would only be useful in pretty obscure situations; in the majority of situations I would use raycasting. I'm just dropping in this different answer for ...


5

As requested, one possible solution (with some flaws) is to use raycasting: Attaching a (C#) Script similar to this to the GameObject from which you want to check visibility would work: if(renderer.isVisible) //Check if Camera is turned towards the GameObject first { RaycastHit hit; // Calculate Ray direction Vector3 direction = ...


1

In a first person camera, you can move the camera forward by adding the camera.direction values, scaled by speed * delta values, to the camera position. This moves the camera forward in the direction that the camera is facing. To move the camera forward on just the X and Z planes, you add camera.direction.x and camera.direction.z to the position. Create a ...


0

Some games define rectangular area of the screen that the player can move about in without causing camera movement. Any movement outside of this area will cause the camera to move to compensate. This allows the player to make small movements (e.g. adjusting position on a block or jumping on an enemy) without shifting the camera. Shaun Inman has posted a ...


0

I call the way I do it the rule of the two thirds. Basically the screen height is split in three, and level design is done accordingly to these part sizes. Player avatar is always in the middle part. When she jumps to a higher platform contained in the top third of the screen, the camera moves to center the player. When player reaches the lowest part the ...



Top 50 recent answers are included