playMaker

Author Topic: Angry Birds style camera on MOBILE  (Read 6482 times)

bizilux

  • Full Member
  • ***
  • Posts: 171
Angry Birds style camera on MOBILE
« on: September 15, 2013, 06:12:37 PM »
hey all...

i've done some pretty advanced stuff with playmaker so far, but im stuck with some very basic thing here :)

i want to make angry birds style camera... where you drag with your finger and the camera can move left or right, basically exposing rest of the background/image, and then clamping at one point to prevent camera from dragging any further...

i dont even know how to begin setting up background image to be the most efficient way of doing it, because game is for mobile, so performance is key.

anyone have idea how to tackle this relatively easy problem?

for example: check at 4:04, how he scrolls in game, basically really self explanatory


this is what i've set up so far, but i cant scroll this... i think thats not proper way of setting it up... (check attachments)

oh btw: i tried searching on web a bit, but couldnt really find any answer... i'll try searching a bit more
« Last Edit: September 16, 2013, 05:54:29 PM by bizilux »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Angry Birds style camera
« Reply #1 on: September 16, 2013, 02:25:29 AM »
Hi,

 It's indeed quite complex to implement properly. Look for the following:

-- scrolling is only about moving the camera, not the world. So experiment on dragging the camera:

http://hutonggames.com/playmakerforum/index.php?topic=873.msg3587#msg3587

when you master this, then you can tackel building your environment to be flexible and optimized.

 -- is your world so big that it needs to be cut down in pieces? maybe it doesn't. Unity has some very advanced culling and rendering system, if it's not in view or not int he camera view frustrum it's not taking that much perfs in the end, so this is something to study and experiment first very seriously before diving into dynamic loading of your level.

If it does:

-- having some triggers that detects when a new block need to be added and load hat block. so essentially you could be makign prefabs of each of your blocks, make sure you save their respective position and have a trigger system that load them when the camera will see them.

 Look the asset store for systems like that, LOD would be a very good starting point for example.

Bye,

 Jean

bizilux

  • Full Member
  • ***
  • Posts: 171
Re: Angry Birds style camera
« Reply #2 on: September 16, 2013, 08:06:06 AM »
thanks for reply... well i dont think its that big that it needs to be cut in pieces, actually it is just one big landscape picture...

lets say it would be resolution of 1024x512, not that big of a deal to load and keep in game...


edit: just bought 2D toolkit... playing around with it a bit, hopefully i will figure it out :)
« Last Edit: September 16, 2013, 05:42:17 PM by bizilux »

bizilux

  • Full Member
  • ***
  • Posts: 171
Re: Angry Birds style camera
« Reply #3 on: September 16, 2013, 05:53:53 PM »
ok i sort of fixed background for now...

but dragging the camera on X axis... uh, boy i was wrong that this is gonna be an easy job...


this is my best try so far...    it works for moving objects around... but on camera it doesnt seem to be working



too bad this no longer works:
http://hutonggames.com/playmakerforum/index.php?topic=270.msg1185#msg1185
« Last Edit: September 16, 2013, 05:55:25 PM by bizilux »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Angry Birds style camera on MOBILE
« Reply #4 on: September 17, 2013, 02:42:25 AM »
Hi,

 What doesn't work on that thread? let me know, cause it's all fine from what I can tell.

bye,

 Jean

bizilux

  • Full Member
  • ***
  • Posts: 171
Re: Angry Birds style camera on MOBILE
« Reply #5 on: September 17, 2013, 05:28:03 AM »
well when i click on "import new asset" and select camera_3d_drag_touch_input.asset
...it gives me errors that script cant be loaded...



* camera_3d_drag_touch_input.asset (18.78 kB, 72x99 - viewed 714 times.)
from this post: http://hutonggames.com/playmakerforum/index.php?topic=270.msg1185#msg1185


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Angry Birds style camera on MOBILE
« Reply #6 on: September 17, 2013, 07:28:17 AM »
Hi,

Can you try on a fresh project.

what error exactly do you get, can you copy paste them? thanks

bye,

 Jean

bizilux

  • Full Member
  • ***
  • Posts: 171
Re: Angry Birds style camera on MOBILE
« Reply #7 on: September 17, 2013, 08:39:58 AM »
hey

this is the error


i clicked assets -> import new assets

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Angry Birds style camera on MOBILE
« Reply #8 on: September 18, 2013, 02:25:00 AM »
Hi,

 your project should be error free before importing packages.

go to the Unity console and see what errors are listed. Can you paste them?

bye,

 Jean

bizilux

  • Full Member
  • ***
  • Posts: 171
Re: Angry Birds style camera on MOBILE
« Reply #9 on: September 18, 2013, 08:17:18 AM »
ok i started new project yet again.


1.  assets -> import package -> custom package -> and selected playmaker

2. assets -> import new asset ->  and selected "camera_3d_drag_touch_input.asset"

because it is .asset     right?

and this is it:   that file is not working...  "camera_3d_drag_touch_input.asset"  from this post: http://hutonggames.com/playmakerforum/index.php?topic=270.msg1185#msg1185
i mean it is from 2011 so maybe unity changed something... or im doing something wrong...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Angry Birds style camera on MOBILE
« Reply #10 on: September 20, 2013, 03:03:07 AM »
Hi,

 ok. you are trying to load the wrong asset actually:

get this one:

http://hutonggames.com/playmakerforum/index.php?topic=270.msg1092#msg1092

it ends with .unitypackage actually

bye,

 Jean

bizilux

  • Full Member
  • ***
  • Posts: 171
Re: Angry Birds style camera on MOBILE
« Reply #11 on: September 20, 2013, 02:05:10 PM »
well i already have your version... but your version is only for mouse setup... and i tried to convert it to touch setup... but im really just learning how to do touch things and this is a bit ahead of me for now...

and Blitzy seems to have done it, and shared that .asset file, but i dont know what to do with it...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Angry Birds style camera on MOBILE
« Reply #12 on: September 23, 2013, 01:47:01 AM »
Hi,

 me neither...  :) You should pm him to get the proper package.

bye,

 Jean