Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Doghelmer

Pages: 1 [2]
16
Support / Re: Achieving a smooth, lerped zoom effect
« on: September 29, 2014, 06:13:51 am »
Upon closer inspection, it looks like the problem is what I originally thought it was-- the camera doesn't appear to recognize small changes in ZoomFactor.

To give an example of what I'm talking about-- if I set the ZoomFactor to 1 and run this code:

   void Update () {
      if (Input.GetMouseButtonDown (0)) {
         myCamera.ZoomFactor += 0.001f;
      }
   }

.. Clicking the mouse once produces no visible change to the camera.  However, if I click the mouse 6 times so that ZoomFactor is 1.006, a very obvious visual change occurs on that 6th click.  This would explain why the small changes toward the end of my Lerp don't always register in the camera.

Is this just a limitation of how ZoomFactor functions?  If so I can work around it, but it seems like there may not be a way to get the exact effect I'm looking for.

17
Support / Re: Achieving a smooth, lerped zoom effect
« on: September 27, 2014, 10:29:12 pm »
Unfortunately, it doesn't seem like that had any effect.  Here's what I'm doing now:

   void LateUpdate () {
      myCamera.ZoomFactor = Mathf.Lerp(myCamera.ZoomFactor, newZoomFactor, zoomSpeed*Time.deltaTime*60);
   }

This is producing exactly the same result as I was seeing previously.

18
Support / Achieving a smooth, lerped zoom effect
« on: September 26, 2014, 06:53:12 pm »
I've been attempting to get a smooth camera zoom effect using the tk2dcamera.  Here's what my code looks like (in FixedUpdate):

myCamera.ZoomFactor = Mathf.Lerp(myCamera.ZoomFactor, newZoomFactor, zoomSpeed);

..where zoomSpeed is set to 0.1.

The code works as expected, except for one problem: The camera's zoom motion can become very choppy.  It's especially noticeable toward the end of a camera motion-- it looks like the camera's visual zoom level is not being updated every frame. I can see the ZoomFactor value going up or down in the Inspector, but it seems like maybe the camera is only updated at certain numerical thresholds?

19
Support / Best Practice for destructible tilemaps?
« on: September 18, 2014, 10:53:02 am »
I’m currently developing a top-down game where wall tiles are frequently destroyed, and the map size is fairly large (around 160x160 tiles).  I haven’t dived too far into tilemap creation yet, but given that destructibility is a super-important aspect of my game, I’m wondering what the most efficient way to accomplish this would be.

Would I want to use colliders on the tilemap tiles, or would this be a bad idea if I’m going to be frequently rebuilding the tilemap?

If it’s OK to do things this way, what is the best way of checking for collision between a bullet sprite and one of the individual tiles?

If it’s not a good idea to use colliders, would perhaps a better solution be to dynamically position a bunch of box collider GameObjects to match up with the tilemap in the area directly surrounding the player?  Or is there a more common solution?

20
Support / Creating a "pixel art" game and using bilinear filtering
« on: September 06, 2014, 09:14:24 pm »
The game I’m developing uses tiles that are 16x16 pixels for its art.  The camera is zoomed out a lot, so the play area looks similar to the game Hammerwatch:
http://greenlitgaming.com/wp-content/uploads/2013/02/Hammerwatch-Vendor.png

My camera moves around a lot, and I’ve found that using bilinear filtering on my tiles causes the game to have an overall much “smoother” appearance than point sampling while in motion.  As expected, this causes the 16x16 tiles to look extremely blurry.  My solution is to scale the images up in Photoshop using Nearest Neighbor, to 64x64, which eliminates that blurriness in the game.

My question: Is there some way to do this type of scaling within Unity/2D Toolkit, or possibly at runtime?  It’s annoying to have to create a second "large" version each image in the game, not to mention when I have to go back and modify those images.

Hammerwatch was able to achieve a smoothness of motion while retaining crisp sprites-- I think they were using their own engine, but I’d love to know the best way to achieve this in Unity.

Pages: 1 [2]