Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

New answers tagged

0

You can use some sort of flag to skip WM_MOUSEMOVE handling whenever you are adjusting cursor position. That may seem a bit hacky too, but that's how usually this gets done.


1

You can use GetCursorPos, and use the result from that to calculate how far the mouse has moved from the center, then SetCursorPos to put it back. With this scheme you don't even need to handle WM_MOUSEMOVE messages; just call GetCursorPos each frame. This, IIRC, is the approach used by Quake and derivatives.


0

Playing with Near/Far clip values by layers would basically mean to render every object using a different camera. Which would probably be overkill. I think what you're looking for is a custom shader on specific objects or group of objects that would "cut" them in given depth. Please look at this very cool tutorial on how to achieve such an effect.


0

I believe the solution I found is not unique. Just on the game screen (with the code of the question itself) take a printscreen and add as a sprite in the game. Problem and printscreen: Obviously the printscreen has to be taken without the objects present in the circuit being visible. Just disable the visibility of objects. The code looks like this: ...


3

You can easily know if a world point is visible by a given camera using Camera.WorldToViewportPoint. This will return a Vector2 that represents the position of your object in the viewport. A viewport goes from [0,0] (bottom left) to [1,1] (top right). If the returned value has a component lower than 0 or higher than 1 it means that the object is offscreen (...


0

Export fbx from blender with scale 0.08. Make sure to export the camera only. Import your fbx asset in your Unity project. You have to add an animator to the camera. Editing the animator, you drag and drop your motion fbx. Press DEL to remove the first of the two animations. Magically your camera is responding your animation.


1

It's a bit hard to give you a specific solution without seeing a screenshot or diagram of the current vs desired behavior, but looking at your script I can suggest two general approaches to extend your camera behavior: 1) Offsetting the targeted point (changing the LookAt target, as you mentioned) 2) Offsetting the camera position or rotation I've added ...


0

Thanks @DMGregory for pointing this out. Fixed it by initializing xAxisRotation and yAxisRotation variables to camera's start rotations and by changing the target rotation. Initialized those at start method and i have also carefully set clamping values according to default camera x and y rotations. My start method now looks like this: void Start() { ...


0

So I found that it was because of where I have the cube relative to my camera. So my picture would emphasize the bottom of the cube, as the cube is above the camera. But in his picture the cube is dead center to the camera so he'll see a square. If the cube was below the camera then the top would be emphasized. Same thing with the sides. I found 2 pictures ...


Top 50 recent answers are included