Log in or register to post comments

Camera Jitter

June 8, 2011 - 10:43am #1

Hey Everyone,

I am developing a quick fps to test out augmented-reality and I ran into a problem. I have a guiText showing me the positing of the AR camera and it seems to be always moving. That seems normal but when I put objects relative to the camera's position, they will fly everywhere.

C# Example:
gameObject.transform.position = camera.ScreenToWorldPoint(new Vector3(camera.pixelWidth/2, camera.pixelHeight/2, 30));

The code is called during an object's update; it should put the object in the center of my screen in world space. The problem is that after the first frame, the object will pop in and out of screen because of the camera's movement.

is there someway i can put an object on my screen without it moving sporadically? (and i don't want to use guiTexture, it needs to be 3D)

Re: Camera Jitter

June 11, 2011 - 2:54pm #6

Try observing the target from an angle (e.g. 45 deg above the plane of the target). This can yield better results for offset models. The apparent distortion is actually helpful in determining the target position and orientation.

Re: Camera Jitter

June 10, 2011 - 3:46pm #5

Thanks for the quick reply. The projectile are instantiated and arent children of any other object.

SPS_John

Re: Camera Jitter

June 10, 2011 - 1:24pm #4

There is a certain amount of error involved in the relationship between the camera object and the target. This error is multiplied as your render further away from the center of the target. I would expect a little bit of jitter when you first launch, but it should decrease as the object flies towards the target.

Are your projectiles children of anything?

I've filled a bug report with your video, we'll look into this further.

- Kim

Re: Camera Jitter

June 9, 2011 - 1:40pm #3

Hello ksiva,

I've made the object a children of the camera and it works very well. Although, putting the code in LastUpdate() didn't work. I'll just have to work with what I have.

Anyways, I have a new problem. I instantiate a dart everytime I swipe the screen and set its velocity to (0, -40, 20). It shakes and jitters as it moves. I can't really explain why so I recorded a video of it. Does anyone have any clue what is causing it.

I attached a device on a tripod to ensure that the shaking isn't due to unsteady hands. link

Re: Camera Jitter

June 9, 2011 - 6:10am #2

Perhaps make the object a child of the camera? That way it will move with the camera. Alternatively, you could try placing your code in the LateUpdate callback so it happens after the camera has been positioned for the frame.

- Kim

Log in or register to post comments