<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Tag: camera - Recent Topics</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/camera</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 04:05:24 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/tags/camera/topics" rel="self" type="application/rss+xml" />

		<item>
			<title>Rocketman697 on "Interesting &quot;twist&quot; on importing camera animations from POD file"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28719#post-141550</link>
			<pubDate>Fri, 27 Jan 2012 16:42:21 +0000</pubDate>
			<dc:creator>Rocketman697</dc:creator>
			<guid isPermaLink="false">141550@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have successfully created a scene in Maya, exported it with PVRGeoPOD and imported it into a cocos3d project.  The scene contains mesh and camera animations which I want to use in my project.  I found that the mesh animations worked perfectly, but camera animations were not oriented properly.</p>
<p>I have made no changes to the default axis in Maya, and mesh animations are working well, so it would be great if camera animations did as well.  I have some complex camera moves that would be hard to recreate in Xcode.  Though the workarounds I came up with do work, it would be better if cocos3d could import camera animations without need to make any changes.</p>
<p>To work around this issue, first I copied the camera animation to a mesh cube in Maya, then in Xcode I copied the mesh animation to the camera.  It worked perfectly!</p>
<p>Next, I wanted to see what was being changed, so I experimented with creating a structural node, making the camera a child, then moving the animation to the structural node.  This way I could rotate the camera independently of the animation.  Here's what I came up with:</p>
<pre><code>// Get the camera from the POD file
    camera1 = (CC3Camera*)[self getNodeNamed:@&#34;camera1&#34;];
    self.activeCamera = camera1;  

    // Put this camera under a parent node
    camParent = [[CC3Camera alloc] initWithName:@&#34;camParent&#34;];
    [self addChild:camParent];
    [camParent addChild:camera1];

    // *** HERE IS THE CAMERA ANGLE CORRECTION ***
    [camera1 rotateByAngle:-90 aroundAxis:CC3VectorMake(1, 0, 0)]; // The camera direction appears to be rotated from pointing to -z to y, rotate it back
    camParent.animation = camera1.animation; // Copy the animation to the parent node
    camera1.animation = NULL;

    // Run the animation from the POD file
    [camParent runAction: [CCRepeatForever actionWithAction:[CC3Animate actionWithDuration:10.0]]];</code></pre>
<p>So my question is this: Does PVRGeoPOD do this, and if so can it be corrected in the cocos3d import module?
</p></description>
		</item>
		<item>
			<title>FJ on "100% working solution for the pinch-zoom &amp; pan-move with boundaries control??"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19178#post-107524</link>
			<pubDate>Thu, 28 Jul 2011 06:08:10 +0000</pubDate>
			<dc:creator>FJ</dc:creator>
			<guid isPermaLink="false">107524@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi everybody,</p>
<p>I decide to create this thread because after going through a lot of threads I'm still stuck with this problem:<br />
I want to be able to pinch and zoom in/out (anywhere on the screen) and pan-move my layer (bigger than the screen size: 960x640) but keeping it within the limits, thus is no showing any "black background".<br />
I would like to achieve this using gesture recognizers.</p>
<p>Anybody has a 100% working code? So far I couldn't find a solution that works 100%.<br />
Just to be sure that we have the same image about what I would like to achieve, think about the "angry birds" interface and how it works.</p>
<p>Thanks to everybody in advance! :)
</p></description>
		</item>
		<item>
			<title>eshirt on "Pinch-Zoom like Fieldrunners"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2229#post-13992</link>
			<pubDate>Thu, 01 Oct 2009 18:00:47 +0000</pubDate>
			<dc:creator>eshirt</dc:creator>
			<guid isPermaLink="false">13992@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I know it's been discussed on some old posts, but I don't think I quite got the full picture from them.  In 0.8.1, I'm trying to achieve a pinch-zoom effect similar to Fieldrunners.  </p>
<p>For those not familiar, the scene would load with a background image of 2x the screen size (960x640) and set the background, etc.  I would want the camera to be "zoomed out" to fit the whole scene in the screen when the scene is loaded.  Then using the pinch gesture in ccTouchesBegan and ccTouchesMoved, I would want to modify the zoom factor.</p>
<p>Would I set my bg image, camera view, etc. in the init method, then adjust the zoom factor in the touches events?  </p>
<p>Any tips or references on how I should go about setting this up are appreciated!
</p></description>
		</item>
		<item>
			<title>Blue Ether on "CCUIViewWrapper - wrapper for manipulating UIViews using Cocos2D"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6889#post-40440</link>
			<pubDate>Sun, 06 Jun 2010 16:24:08 +0000</pubDate>
			<dc:creator>Blue Ether</dc:creator>
			<guid isPermaLink="false">40440@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I wanted to share a class I've written I'm calling CCUIWrapper, which acts as a way of manipulating UIViews via Cocos2D methods.  It's not the most momumental class ever written and most of what it does is simple but a few of the pieces took a bit of tinkering and head scratching to put together.  I'm sharing this because I think many people might find it very useful, and I'm inclined to believe that it should even be included as part of Cocos2D.  UIViews can do many things that Cocos cannot, and the differences between the two systems make them very confusing to merge together.  Hopefully this class simplifies the process for people.</p>
<p>Applications:<br />
I originally started developing this to be used for fading and moving AdMob ads.  I have continued tinkering with it for use with an iPad app that has a few UITextFields and where rotations are needed to allow for orientation changes.</p>
<p>First, how to initialize a UIView with the wrapper:<br />
<pre><code>UIView *myView	= [[[UIView alloc] init] autorelease];
CCUIViewWrapper *wrapper = [CCUIViewWrapper wrapperForUIView:myView];
wrapper.contentSize = CGSizeMake(320, 160);
wrapper.position = ccp(64,64);
[self addChild:wrapper];

// cleanup
[self removeChild:wrapper cleanup:true];
wrapper = nil;</code></pre>
<p>The wrapper puts a retain on its UIView, so you can autorelease it as you create it.  In practice though, you probably want to maintain a seperate reference to the UIView since you don't want to have to keep casting and type checking the UIView to see if its actually the UITextField (or whatever else) that you created.</p>
<p>The view doesn't have to be initialized with a frame size (though it can be), because setting the content size of the wrapper automatically resizes the frame.  Also, adding the wrapper to another Cocos object will automatically add its associated uiView to the Cocos openGLView window.</p>
<p>Next, usage:<br />
<pre><code>[wrapper runAction:[CCRotateTo actionWithDuration:.25f angle:180]];
wrapper.position = ccp(96,128);
wrapper.opacity = 127;
[wrapper runAction:[CCScaleBy actionWithDuration:.5f scale:.5f];
wrapper.visible = false;</code></pre>
<p>After creation, you can basically treat the wrapper as if it were the UIView.  Anywhere you position the wrapper, that's where the UIView will be.  Similarly, you can modify visibility, opacity, rotation, and scale.  The UIView is automatically updated.  This includes modifications made via actions.</p>
<p>Questions / Limitations / Missing functionalities:<br />
- I've tried to make the wrapper include transforms of its parents.  However, I'm not sure if this includes scale or opacity, as I haven't tested it.  Honoring parent rotations was a bit of work to get set up, and I didn't need to worry about honoring parent scale or parent opacity for my application.<br />
- I'm not sure if rotations will work right unless the anchor point of the wrapper is at .5,.5 (though position should work fine).  I was only using center anchor points, so it didn't come up.<br />
- I'm also not sure if you add subviews to your UIView whether those will be positioned properly, though I assume they will<br />
- If you transform the wrapper's parent/grandparent/etc, the wrapper can handle that, but it needs to be told it has to recalculate the uiView's position.  You can do this by calling: [wrapper updateUIViewTransform];<br />
If, for example, you are running a CCRotateTo action on the wrapper's parent, then updateUIViewTransform will need to be called every frame during that action.  Maybe there is a better way of integrating the update method so that Cocos will automatically trigger the code?  I'm not very familiar with the very low level of how Cocos lets children know their parent has changed transformation.</p>
<p>Finally, here is the source:<br />
CCUIViewWrapper.h<br />
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;cocos2d.h&#34;

@interface CCUIViewWrapper : CCSprite
	{
	UIView *uiItem;
	float rotation;
	}

@property (nonatomic, retain) UIView *uiItem;

+ (id) wrapperForUIView:(UIView*)ui;
- (id) initForUIView:(UIView*)ui;

- (void) updateUIViewTransform;

@end</code></pre>
<p>CCUIViewWrapper.m<br />
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;CCUIViewWrapper.h&#34;

@implementation CCUIViewWrapper

@synthesize uiItem;

+ (id) wrapperForUIView:(UIView*)ui
	{
	return [[[self alloc] initForUIView:ui] autorelease];
	}

- (id) initForUIView:(UIView*)ui
	{
	if((self = [self init]))
		{
		self.uiItem = ui;
		return self;
		}
	return nil;
	}

- (void) dealloc
	{
	self.uiItem = nil;
	[super dealloc];
	}

- (void) setParent:(CCNode *)parent
	{
	if(parent == nil)
		[uiItem removeFromSuperview];
	else if(uiItem != nil)
		[[[[CCDirector sharedDirector] openGLView] window] addSubview: uiItem];
	[super setParent:parent];
	}

- (void) updateUIViewTransform
	{
	float thisAngle, pAngle;
	CGAffineTransform	transform = CGAffineTransformMakeTranslation(0, [[UIScreen mainScreen] bounds].size.height);

	for(CCNode *p = self; p != nil; p = p.parent)
		{
		thisAngle = CC_DEGREES_TO_RADIANS(p.rotation);

		if(!p.isRelativeAnchorPoint)
			transform = CGAffineTransformTranslate(transform, p.anchorPointInPixels.x, p.anchorPointInPixels.y);

		if(p.parent != nil)
			{
			pAngle = CC_DEGREES_TO_RADIANS(p.parent.rotation);

			transform = CGAffineTransformTranslate(transform,
						(p.position.x * cosf(pAngle)) + (p.position.y * sinf(pAngle)),
						(-p.position.y * cosf(pAngle)) + (p.position.x * sinf(pAngle)));
			}
		else
			transform = CGAffineTransformTranslate(transform, p.position.x, -p.position.y);

		transform = CGAffineTransformRotate(transform, thisAngle);
		transform = CGAffineTransformScale(transform, p.scaleX, p.scaleY);

		transform = CGAffineTransformTranslate(transform, -p.anchorPointInPixels.x, -p.anchorPointInPixels.y);
		}

	[uiItem setTransform:transform];
	}

- (void) setVisible:(BOOL)v
	{
	[super setVisible:v];
	[uiItem setHidden:!v];
	}

- (void) setRotation:(float)protation
	{
	[super setRotation:protation];
	[self updateUIViewTransform];
	}

- (void) setScaleX:(float)sx
	{
	[super setScaleX:sx];
	[self updateUIViewTransform];
	}

- (void) setScaleY:(float)sy
	{
	[super setScaleY:sy];
	[self updateUIViewTransform];
	}

- (void) setOpacity:(GLubyte)opacity
	{
	[uiItem setAlpha:opacity/255.0f];
	[super setOpacity:opacity];
	}

- (void) setContentSize:(CGSize)size
	{
	[super setContentSize:size];
	uiItem.frame	= CGRectMake(0, 0, self.contentSize.width, self.contentSize.height);
	uiItem.bounds	= CGRectMake(0, 0, self.contentSize.width, self.contentSize.height);
	}

- (void) setAnchorPoint:(CGPoint)pnt
	{
	[super setAnchorPoint:pnt];
	[self updateUIViewTransform];
	}

- (void) setPosition:(CGPoint)pnt
	{
	[super setPosition:pnt];
	[self updateUIViewTransform];
	}

@end</code></pre>
<p>EDIT: I should note, I developed this for 0.99.2.  I haven't tested it with 0.99.3.
</p></description>
		</item>
		<item>
			<title>duncan on "Camera, Flipping for no reason"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28526#post-140436</link>
			<pubDate>Fri, 20 Jan 2012 18:26:04 +0000</pubDate>
			<dc:creator>duncan</dc:creator>
			<guid isPermaLink="false">140436@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I've just started trying to create alternate camera views.</p>
<p>I created a camera in blender that is a child of a node.</p>
<p>I then set it up in cocos3d as follows</p>
<p>    CC3Camera* cameraFromBehind;<br />
    cameraFromBehind = (CC3Camera*)[self getNodeNamed: @"TrackingCamera"];<br />
    cameraFromBehind.target = activeTruck.turnTable;<br />
    self.activeCamera = cameraFromBehind; </p>
<p>When the world loads for a split second it has the correct orientation then it rotates 90 degrees to the right.<br />
I have commented out all my world update code, but it seems to happen every time, am I missing something obvious?</p>
<p>Thanks<br />
Duncan
</p></description>
		</item>
		<item>
			<title>Sorien on "Strange cocos2d camera and tilemap issue"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28163#post-138528</link>
			<pubDate>Sat, 07 Jan 2012 15:58:49 +0000</pubDate>
			<dc:creator>Sorien</dc:creator>
			<guid isPermaLink="false">138528@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>For the menu background of Nitroman i am using a tile-map with a moved camera. When i start a game-level the tile-map within the game is working like it should, but if i go back to the main screen the Menu-tile-map is messed up.</p>
<p>Here is the working menu background tilemap:<br />
<img src="http://nitroman.alpapps.com/wp-content/uploads/2012/01/IMG_0179.png" /></p>
<p>And here it the messed up background tilemap:<br />
<img src="http://nitroman.alpapps.com/wp-content/uploads/2012/01/IMG_0180.png" /></p>
<p>The MenuScene is completely new initialized and all the positions and settings are the same like the first initialization.</p>
<p>Also the camera positions for center, eye and up are the same in both.</p>
<p>Here is the code:<br />
<pre><code>- (void) initMap{
    // add Background
    CCLayerColor *color = [CCLayerColor layerWithColor:ccc4(0,0,0,255)];
    [self addChild:color z:-1];
    if([DeviceDetector sharedDeviceDetector].isIPad &#38;&#38; [DeviceDetector sharedDeviceDetector].hasRetinaDisplay){
        map = [TMXTiledMapExtended tiledMapWithTMXFile:DOCUMENTS_RESOURCES_PATH(@&#34;levels/default_levels/tilemaps/MainMenu/iNitroMan_MainMenu-hd.tmx&#34;)];
    } else {
        map = [TMXTiledMapExtended tiledMapWithTMXFile:DOCUMENTS_RESOURCES_PATH(@&#34;levels/default_levels/tilemaps/MainMenu/iNitroMan_MainMenu.tmx&#34;)];
    }&#60;/p&#62;
    [self addChild:map z:1];
    for( CCSpriteBatchNode* child in [map children] ) {
        [[child texture] setAntiAliasTexParameters];
    }
    [map setAnchorPoint:ccp(0, 1)];
    DEBUG_LOG(@&#34;MAP-Scale       (%f,%f)&#34;,map.scaleX,map.scaleY);
    DEBUG_LOG(@&#34;MAP-TileSize    (%f,%f)&#34;,map.tileSize.width,map.tileSize.height);
    DEBUG_LOG(@&#34;MAP-MapSize     (%f,%f)&#34;,map.mapSize.width,map.mapSize.height);
}
- (void) initCamera{
    float x, y, z = -100;
    float eye_x, eye_y, eye_z = 1;
    float up_x, up_y, up_z = 1;
    [[map camera] centerX:&#38;x centerY:&#38;y centerZ:&#38;z];
    [[map camera] upX:&#38;up_x upY:&#38;up_y upZ:&#38;up_z];
    [[map camera] eyeX:&#38;eye_x eyeY:&#38;eye_y eyeZ:&#38;eye_z];
    [map getPixelPositionFromGridPoint:CGPointMake(12,1) pX:&#38;x pY:&#38;y];
    [map getPixelPositionFromGridPoint:CGPointMake(12,7) pX:&#38;eye_x pY:&#38;eye_y];
    if([DeviceDetector sharedDeviceDetector].isIPad){
        [[map camera] setEyeX:eye_x eyeY:eye_y eyeZ:500];
    } else {
        eye_z = 1;
        [[map camera] setEyeX:eye_x eyeY:eye_y eyeZ:1];
    }
    z = -100;
    DEBUG_LOG(@&#34;CAM-Eye     (%f,%f,%f)&#34;,eye_x,eye_y,eye_z);
    DEBUG_LOG(@&#34;CAM-Center  (%f,%f,%f)&#34;,x,y,z);
    DEBUG_LOG(@&#34;CAM-Up      (%f,%f,%f)&#34;,up_x,up_y,up_z);
    [[map camera] setCenterX:x centerY:y centerZ:z];
    [[map camera] setUpX:up_x upY:up_y upZ:up_z];
}</code></pre>
<p>Does anyone know why this happens? </p>
<p>Thanks for your help.
</p></description>
		</item>
		<item>
			<title>ayakamal on "1st Person Camera"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27608#post-136191</link>
			<pubDate>Tue, 20 Dec 2011 17:08:36 +0000</pubDate>
			<dc:creator>ayakamal</dc:creator>
			<guid isPermaLink="false">136191@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I really need your help, I'm creating my first 3d game on iphone ; it's a first person based camera system. and I'm simply stumped on how to deal with Cocos3d camera I read the documentation and programming guide and checked the demos, but the joystick in the demo is not really what I have in mind. I want something simple where I can press a button to move forward , tilt the device to rotate the camera right and left ; this kind of thing. I already implemented the concept on c++ and openGL before but I'm having a problem implementing this concept on cocos3d...Thanks in advance!<br />
Also, I feel we developers should start writing tutorials to help out with cocos3d as I truly feel it doesn't have the examples and demonstration it deserves.....<br />
It is a piece of art! I'm really glad I'm starting to go deeper into it!
</p></description>
		</item>
		<item>
			<title>tim on "background clipping with orbitcamera and 3d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/12691#post-71197</link>
			<pubDate>Mon, 17 Jan 2011 20:02:13 +0000</pubDate>
			<dc:creator>tim</dc:creator>
			<guid isPermaLink="false">71197@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hi there, I am new to this forum and hope to find some help on an issue.</p>
<p>-&#62; here is, what i want to do:</p>
<p>1. Scene with multiple Layers<br />
2. Each Layer may contain a Background-Sprite<br />
3. At least one layer contains sprite that will be x-flipped (3d) on touch.</p>
<p>-&#62; What I tried:<br />
1. Using  CCOrbitCamera to achieve the flipping-goal (3d) as well the CCFlipX3d<br />
2. Using 2d and 3d projection</p>
<p>See simple code-example within INIT-method of MainScreen (I tested this code on device and simulator without success):<br />
<pre><code>CGSize size = [CCDirector sharedDirector].winSize;

//BACKGROUND
CCSprite* bg = [CCSprite spriteWithFile:@&#34;bg.png&#34;];
bg.position = ccp(size.width / 2.0, size.height / 2.0);
[self addChild:bg z:-1];

//SPRITE that will be flipped
CCSprite* _card = [CCSprite spriteWithFile:@&#34;card.png&#34;];
[self addChild:_card z:1];

float d = 2;
[_card runAction:
		 [CCRepeatForever actionWithAction:
		  [CCSequence actions:
		   [CCOrbitCamera actionWithDuration:d/2 radius:1 deltaRadius:1
									  angleZ:0 deltaAngleZ:90 angleX:0 deltaAngleX:0],

		   //here goes an Image-SwapAction later on...

		   [CCOrbitCamera actionWithDuration:d/2 radius:1 deltaRadius:1
									  angleZ:270 deltaAngleZ:90 angleX:0 deltaAngleX:0],
		   nil]
		  ]
		 ];</code></pre>
<p>Here is what does not work very well:<br />
-&#62; The flipping Card-Sprite gets clipped by the background-sprite<br />
-&#62; Same with CCLayerColor instead of Sprite<br />
-&#62; When I skip adding a background, everything works just fine</p>
<p>Any help is very appreciated! Thanks in advance.<br />
Tim
</p></description>
		</item>
		<item>
			<title>toglia3d on "Camera rotation around pivot point."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/23723#post-128270</link>
			<pubDate>Wed, 23 Nov 2011 02:50:58 +0000</pubDate>
			<dc:creator>toglia3d</dc:creator>
			<guid isPermaLink="false">128270@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I've been playing around the <strong>setUp</strong> method of cocos2d camera and although I've been able to rotate the camera just like I want I'm still having a lot of trouble defining the pivot point of the rotation itself. After almost a full day of testing I'm very unsure it is even posible to rotate the camera from a pivot point different than the center of the screen like posted here:<br />
<a href="http://www.cocos2d-iphone.org/forum/topic/618" rel="nofollow">http://www.cocos2d-iphone.org/forum/topic/618</a></p>
<p>Can anybody body else confirm this? In that case is there some work around, will I have to do opengl directly?</p>
<p>Thanks for any help.
</p></description>
		</item>
		<item>
			<title>manucorporat on "Gaussian BLUR implemented in cocos2d!"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6315#post-36962</link>
			<pubDate>Mon, 10 May 2010 22:33:51 +0000</pubDate>
			<dc:creator>manucorporat</dc:creator>
			<guid isPermaLink="false">36962@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have implemented the gaussian blur in cocos2d. (<a href="http://en.wikipedia.org/wiki/Gaussian_blur" rel="nofollow">http://en.wikipedia.org/wiki/Gaussian_blur</a>)<br />
This is the blur effect used in Photoshop for example.</p>
<p><strong>What are the utilities??</strong><br />
- Dinamic blur effect in your textures.<br />
- Shadows or glossy effect in the labels.<br />
- New transitions.<br />
- Awesome background effects in the HUD or in the pause menu.</p>
<p><img src="//devblog.abstractionworks.com/wp-content/uploads/2010/05/Screenshot-2010.05.11-00.20.511.png" /><br />
<strong>Note:</strong> This image was rendered in a ipad and the images are statics.</p>
<p>This effect will be used in AbstractWar HD (<a href="http://devblog.abstractionworks.com/category/abstractwar/abstractwarhd/" rel="nofollow">http://devblog.abstractionworks.com/category/abstractwar/abstractwarhd/</a> ).</p>
<p>I am going to publish the code, tomorrow in this thread.
</p></description>
		</item>
		<item>
			<title>dgtheman on "How to fully implement Game Center with cocos2d?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22392#post-124274</link>
			<pubDate>Wed, 02 Nov 2011 23:20:38 +0000</pubDate>
			<dc:creator>dgtheman</dc:creator>
			<guid isPermaLink="false">124274@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Game center is amazing and I would really like to learn how to implement it inside cocos2d. I have seen ray's tutorial on it, and I sort of understand the concept. However, I don't care as much for the leaderboards/achievements as I do for the random multiplayer and the assignment of a player. See I would like to know how you can create something like a map (CCLayer) that all the players can play in. Moreover, I would like to figure out if there is a way to attach a player to lets say a ccsprite, and have a player see the map with the view of only his CCSprite, so the camera is set only on the ccsprite. Pretty much each player has his own sprite or character and can only view the world from his own character's view (third person). And also I would like to know if the layer can incorporate the Box2d physics engine so each player would essential be playing in a b2World and they would all be inside the same map. Also, I would like to know how one can make teams...it sort of hints at the possibility in the apple documentation but doesn't really explain. </p>
<p>Thanks for any suggestions!!</p>
<p>Also, if its possible please try to provide source code or a good website I can go to and learn about this. I have seen ray's tutorial and it didnt really cover this. Also, apple's documentation is great and I will probably use it to gain a deeper understanding of Game Center, but I really want to know how you can incorporate SPECIFIC cocos2d data inside Game Center because that would make things soooooo much easier!!
</p></description>
		</item>
		<item>
			<title>Jugon on "UIImagePicker problem"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22488#post-124824</link>
			<pubDate>Mon, 07 Nov 2011 12:44:48 +0000</pubDate>
			<dc:creator>Jugon</dc:creator>
			<guid isPermaLink="false">124824@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hy guys,<br />
i have problems using UIImagePicker in my cocos application (Landscape orientation)...</p>
<p>I attach the UIImahePicker view to my EAGLView but the view is portrait... my CCDirector have GAME_AUTORATION in kGameAutorotationUIViewController... why it's not in landscape mode?</p>
<p>I have to apply a transform myself to the view?</p>
<p>thanks
</p></description>
		</item>
		<item>
			<title>Condor on "Getting camera position / showing direction to offscreen objects"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21482#post-119367</link>
			<pubDate>Mon, 03 Oct 2011 15:58:32 +0000</pubDate>
			<dc:creator>Condor</dc:creator>
			<guid isPermaLink="false">119367@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have a big tilemap and player sprite, controlled by accelerometer tilt. Camera is tracking player using runAction:</p>
<p><code>[self runAction:[CCFollow actionWithTarget:player worldBoundary:CGRectMake(0, 0, self.tileMap.mapSize.width*self.tileMap.tileSize.width, self.tileMap.mapSize.height*self.tileMap.tileSize.height)]];</code></p>
<p>Also I am adding 5 objects-sprites on map in random places. If they're off screen I want to display marks on sides of the HUD to show direction to that objects.<br />
First idea for now - find intersection of line between player and object and the border of screen.<br />
How can I do this? Some way to get x,y of camera view point?</p>
<p>Using cocos2d and Chipmunk with SpaceManager.</p>
<p>Thank you.
</p></description>
		</item>
		<item>
			<title>yogesh on "Camera Problem when loading object from POD File"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21120#post-117386</link>
			<pubDate>Thu, 22 Sep 2011 07:39:24 +0000</pubDate>
			<dc:creator>yogesh</dc:creator>
			<guid isPermaLink="false">117386@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all i am creating new 3d game where i need to rotate and move the camera along some path to test it on cocos3d<br />
have created new simple blender object with default box and export to POD File<br />
But it looks some problem in "See Image" camera can any one tell me how to fix it.</p>
<p>and if possible attach some sample blender model that can be test.</p>
<p><img src="http://content.screencast.com/users/TeknowledgeMobile/folders/Jing/media/cab61787-24c2-4051-a5cb-3c9f0f0b3d86/00000008.png" alt="" /><br />
<img src="http://content.screencast.com/users/TeknowledgeMobile/folders/Jing/media/b86a234a-1a44-4847-9ccd-c9137d694e57/00000007.png" alt="" />
</p></description>
		</item>
		<item>
			<title>Joethemonkey123 on "Anchoring Joystick to Screen?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20566#post-114280</link>
			<pubDate>Sun, 04 Sep 2011 16:43:28 +0000</pubDate>
			<dc:creator>Joethemonkey123</dc:creator>
			<guid isPermaLink="false">114280@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm using SneakyJoystick to move my sprite, and TMX maps. I added auto-camera-movement to my game, so the hero sprite is always visible. When I go through my map, the joystick goes of the screen (it stays where it's original position is). How can I anchor my joystick to the bottom left of the screen, while also using auto-camera-movement?
</p></description>
		</item>
		<item>
			<title>tfsjohan on "Using the build in iphone camera in a Cocos2d app?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20409#post-113500</link>
			<pubDate>Tue, 30 Aug 2011 19:53:49 +0000</pubDate>
			<dc:creator>tfsjohan</dc:creator>
			<guid isPermaLink="false">113500@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'd like to use the front facing camera on the iPhone and display the image in a Cocos2d app. Is that possible? Any ideas how? </p>
<p>// Johan
</p></description>
		</item>
		<item>
			<title>hima on "Rotating camera in 3d world with gyro"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20283#post-112839</link>
			<pubDate>Fri, 26 Aug 2011 15:08:09 +0000</pubDate>
			<dc:creator>hima</dc:creator>
			<guid isPermaLink="false">112839@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi everyone, I'm working on a AR project and currently I'm making it so that the main camera of the CC3World is rotated according to gyrometer. However, the yaw,pitch and roll are all so weird and very hard to understand for me. I think it change depending on the direction of gravity as well.</p>
<p>So instead of using yaw, pitch and roll, I kinda calculate them myself now using gravity I got from CMMotionManager. Still, it isn't perfect and I think using data from gyroscope would be better, if I know how to use it correctly.</p>
<p>Since this is pretty common problem, I think there must be some solutions or some ways to tackle this problem.
</p></description>
		</item>
		<item>
			<title>CodeSlayer on "UIImagePickerController not showing full screen in a CC3Layer"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20142#post-112229</link>
			<pubDate>Tue, 23 Aug 2011 22:42:03 +0000</pubDate>
			<dc:creator>CodeSlayer</dc:creator>
			<guid isPermaLink="false">112229@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I created a menu item Sprite that has a selector pushedCameraBtn. Inside of this I try to show the UIImagePickerController in order for the user to take a picture. However, when I launch the UIImagePickerController it only shows as a non-responsive grey bar at the top of the screen, instead of full screen. Any one know how to fix this ?</p>
<p>Here is the code I am using:</p>
<pre><code>-(void) pushedCameraBtn: (CCMenuItemToggle*) svMI {
    NSLog(@&#34;Hit Camera Button&#34;);
    [self pickPhoto:UIImagePickerControllerSourceTypeCamera];
}

-(void)pickPhoto:(UIImagePickerControllerSourceType)sourceType{

	UIImagePickerController *picker	= [[UIImagePickerController alloc]init];
	picker.delegate = self;
	picker.sourceType = sourceType;
	picker.wantsFullScreenLayout = YES;
	[picker presentModalViewController:picker animated:YES];

	[[[CCDirector sharedDirector] openGLView] addSubview:picker.view];
}</code></pre></description>
		</item>
		<item>
			<title>sonofalink on "UIImagePicker rotation on iPad"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20012#post-111708</link>
			<pubDate>Sat, 20 Aug 2011 21:46:25 +0000</pubDate>
			<dc:creator>sonofalink</dc:creator>
			<guid isPermaLink="false">111708@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Having some UIImagePicker woes in my iPhone/iPad game. My game is Landscape Only.</p>
<p>So when I tap the camera button on my iPad, I have a popover come up with the UIImagePicker in it. But the picture is rotated 90 degrees! (The UIImagePicker controls are correct, it's just the viewfinder which is rotated.)  When I take the picture and use it, however, the picture is correct. Any ideas here?</p>
<p>My code for showing the controller (called from RootViewController)</p>
<pre><code>UIImagePickerController *picker	= [[UIImagePickerController alloc]init];
	picker.delegate = self;
	picker.sourceType = sourceType;
	picker.wantsFullScreenLayout = NO;
    picker.allowsEditing = YES;
    if ([UIImagePickerController respondsToSelector:@selector(isCameraDeviceAvailable:)] &#38;&#38; sourceType == UIImagePickerControllerSourceTypeCamera &#38;&#38; [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront])
    {
        picker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
    }
    sceneDelegate = scene;

    if ([Utility iPad])
    {
        if (![popover isPopoverVisible])
        {
            self.popover = [[UIPopoverController alloc] initWithContentViewController:picker];
            [picker release];
            [popover presentPopoverFromRect:CGRectMake(100, 100.0, 0.0, 0.0)
                                     inView:self.view
                   permittedArrowDirections:UIPopoverArrowDirectionAny
                                   animated:YES];
        }
    }
    else
    {
        [self presentModalViewController:picker animated:YES];
    }</code></pre>
<p>Thank you much!
</p></description>
		</item>
		<item>
			<title>Thnx4TheXP on "Problem with Coordinates??? Need Help!"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20011#post-111705</link>
			<pubDate>Sat, 20 Aug 2011 21:14:35 +0000</pubDate>
			<dc:creator>Thnx4TheXP</dc:creator>
			<guid isPermaLink="false">111705@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have a scene with 2 layers in my game and it is the main scene.<br />
<pre><code>@implementation GameScene

- (id)init
{
    self = [super init];
    if (self) {

		JoystickLayer *joy = [JoystickLayer node];
		[self addChild:joy z:1];

		SinglePlayer *single = [SinglePlayer node];
		[single setJoystick:joy];
		[self addChild:single];

	}

    return self;
}

@end</code></pre>
<p>In my single player layer I have a method (tick) that is called 60 times a second...<br />
<pre><code>-(void)tick {
	for (Player *currentPlayer in playerList) { // Cycle through onscreen players
		[currentPlayer callEveryFrame];
		if (currentPlayer.playerType!=kComputer) { // If human player
			if (joyLayer.pressingLeft) { // If finger on left joystick
				[humanPlayer movePlayerDX:joyLayer.leftAngle.x DY:joyLayer.leftAngle.y];
			}
			if (joyLayer.pressingRight) { // If finger on right joystick
				[humanPlayer rotatePlayerDX:joyLayer.rightAngle.x DY:joyLayer.rightAngle.y];
				[humanPlayer shootBullet];
			}
		} else if (currentPlayer.playerType==kComputer) { // If computer player
			[currentPlayer attackPlayerDX:humanPlayer.player.position.x-currentPlayer.player.position.x DY:humanPlayer.player.position.y-currentPlayer.player.position.y];
		}
		if (currentPlayer.currentlyFiring){
			// Cycle through players
			for (Player *player in playerList) {
				int dx = player.player.position.x-currentPlayer.player.position.x;
				int dy = player.player.position.y-currentPlayer.player.position.y;
				int distance = sqrt(dx*dx+dy*dy);
				if (distance&#62;currentPlayer.gun.range) continue; //If distance is out of range skip
				CGRect boundaryBox = currentPlayer.boundary.boundingBox;
				boundaryBox.origin = CGPointZero; // Make bounding box
				CGPoint locationRelativeToShape = [currentPlayer.boundary convertToNodeSpace:player.player.position];
				if (CGRectContainsPoint(boundaryBox, locationRelativeToShape)) {
					if (player.playerType==currentPlayer.playerType) continue; // If players on same team
					[player hitWithBullet:currentPlayer.playerGunType]; // Hit player with bullet
					if (player.remainingHealth&#62;0) continue; // If player dead continue with method
					[self removeChild:player cleanup:YES]; // Remove dead players
					[playerList removeObject:player];
					if (player.playerType==kComputer) {
						[self initPlayer:computerPlayer position:ccp(arc4random()%480, arc4random()%320) type:kComputer gun:player.playerGunType];
					} else  { // Add human player
						humanPlayer = [[[Player alloc] initWithType:kRedPlayerTeam andGun:humanPlayer.playerGunType layer:self] autorelease];
						humanPlayer.position = ccp(0, 0);
						humanPlayer.player.scale = 0.7f;
						[self addChild:humanPlayer];
						[playerList addObject:humanPlayer];
					}
				}
			}
		}
	}
}</code></pre>
<p>and I have a player class (subclass of ccnode) to hold to boundary sprite in the above code. It checks if any sprites are within that sprite. But when I set the camera to follow the player (ccfollow action) the co-ordinates are off. I already searched the forums and I couldn't find anything.</p>
<p>Any help would be much appreciated. Thanks in advance.
</p></description>
		</item>
		<item>
			<title>CodeSlayer on "Using Camera for background image"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19837#post-110978</link>
			<pubDate>Tue, 16 Aug 2011 23:37:33 +0000</pubDate>
			<dc:creator>CodeSlayer</dc:creator>
			<guid isPermaLink="false">110978@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am encountering a strange error. If I launch my <code>CCNodeController</code> from an <code>IBAction</code> selector all is fine. However if I launch it from the <code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info</code> callback I just get a screen with a strange green / gray streaky appearance.</p>
<p>* If I could attach screen shots it would probably make more sense but this description is the best I can come up with.
</p></description>
		</item>
		<item>
			<title>ts127 on "Game HUD with a Moving Camera?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19929#post-111317</link>
			<pubDate>Fri, 19 Aug 2011 02:13:42 +0000</pubDate>
			<dc:creator>ts127</dc:creator>
			<guid isPermaLink="false">111317@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have a game in which the camera moves alot. And when the camera moves the pause button, score label, etc. go off the screen.  How can i keep my HIUD in the screens view? I tried to keep it a certain distance from the player but the player moves within the camera's view so the score would go off the screen. All help is apprciated!</p>
<p>Thanks!
</p></description>
		</item>
		<item>
			<title>cocos2dbeginner on "What&#039;s better? CCFollow or CCCamera?? And how can I use CCCamera?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/12632#post-70919</link>
			<pubDate>Sat, 15 Jan 2011 17:30:57 +0000</pubDate>
			<dc:creator>cocos2dbeginner</dc:creator>
			<guid isPermaLink="false">70919@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>what's better? CCFollow or CCCamera? How does both work? <strong>Are they only moving the ´layer' or are they really moving the 'camera' </strong>? Does the touch detecting get messed up with cccamera? </p>
<p><strong>How can I use CCCamera?<br />
</strong><br />
I know I have many questions :) But if someone could answer me my questions it would be great :D</p>
<p>Thank you very much!</p>
<p>:)
</p></description>
		</item>
		<item>
			<title>saimonx on "Camera Movement"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19756#post-110604</link>
			<pubDate>Sun, 14 Aug 2011 12:43:33 +0000</pubDate>
			<dc:creator>saimonx</dc:creator>
			<guid isPermaLink="false">110604@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all. </p>
<p>I am developing with cocos3D and i have one problem.</p>
<p>In my application, I use CC3BoxNode as unique model of representation.</p>
<p>I have in my scene maybe ~100 CC3BoxNodes.</p>
<p>What i need is to move the camera over the nodes. The movement is variable. Sometimes the camera has to go at 20z/second and others at 0z/second. Also the angle of movement is variable.</p>
<p>I have implement a way that works to me, but the problem is that it use a lot of battery.</p>
<p>My way is to create a NSTimer that launch a subprogram every 0.1seconds.<br />
There, i calculate (using the speed, the current position and the angle) the point where it should be in the next 0.1 seconds.</p>
<p>Then, when i have the next point, i create a CC3MoveTo to move the camera.</p>
<p>I'd like to know if there is any other way to implement the movement of the camera (or a cc3node).</p>
<p>If someone need the code, i can post it.</p>
<p>Thanks!!!
</p></description>
		</item>
		<item>
			<title>katz on "Moving individual layers (camera) CCTMXTiledMap"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/18958#post-106283</link>
			<pubDate>Thu, 21 Jul 2011 21:11:13 +0000</pubDate>
			<dc:creator>katz</dc:creator>
			<guid isPermaLink="false">106283@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello, i am trying to move individual layers(via moving camera) in my CCTMXTiledMap object, my tmx file has only 2 layers at this moment, but somehow when i move one layer, the other layer moves the same distance, so for example if i move my grass layer 192 pixels, the background layer moves 192 pixels above the grass layer. </p>
<p>i am using this method to move a layer:<br />
<pre><code>-(void)moveLayerWithNameCamera:(NSString*)name toPos:(CGPoint)pos{
	CCTMXLayer* layer1 = [self layerNamed:name];
	[layer1.camera setCenterX:pos.x centerY:pos.y centerZ:0];
	[layer1.camera setEyeX:pos.x eyeY:pos.y eyeZ:[CCCamera getZEye]];
  }</code></pre>
<p>i thought that each layer had its own independant camera, but i dont know why moving one layer affects the other one.
</p></description>
		</item>
		<item>
			<title>GengSongod on "how to take Image from Photo Library or Camera to CCSPrite?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/18768#post-105315</link>
			<pubDate>Sat, 16 Jul 2011 16:19:41 +0000</pubDate>
			<dc:creator>GengSongod</dc:creator>
			<guid isPermaLink="false">105315@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hi plz help me for taking a photo from photo library or camera by cocos2d<br />
and Make it to CCSprite
</p></description>
		</item>
		<item>
			<title>dgtheman on "How to draw 3d (sort of) rectangles?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/17050#post-96113</link>
			<pubDate>Sat, 28 May 2011 16:22:55 +0000</pubDate>
			<dc:creator>dgtheman</dc:creator>
			<guid isPermaLink="false">96113@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi I wanted to know if there was any way to draw rectangles that appear horizontal on the screen. Kind  of like they are climbing up a hill. Here is a visual representation: <img src="http://www.insidemobileapps.com/wp-content/uploads/Shadow-Era.jpg" alt="" /><br />
I want to be able to make a field looking like this one. As one can see their rectangles are positioned in such a way that they get more space throughout the field. I have no idea how they do this, so can someone help me out?
</p></description>
		</item>
		<item>
			<title>vargonian on "UIImage created from UIImagePickerController doesn&#039;t display as CCSprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/15227#post-86385</link>
			<pubDate>Sun, 03 Apr 2011 19:33:55 +0000</pubDate>
			<dc:creator>vargonian</dc:creator>
			<guid isPermaLink="false">86385@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am using an iPad 2 to take a camera photo via the UIImagePickerController.  But the returned image is failing to display when I convert it to a CCSprite, regardless of whether I convert it to a CCTexture2D first, or use its CGImage property as an input to CCSprite spriteWithCGImage:key.  Has anyone else successfully got this to work?  Here is some sample code from my CCLayer class:</p>
<p>      `// WORKS FINE<br />
        CCSprite* iconSprite = [CCSprite spriteWithFile:@"Icon.png"];<br />
        [self addChild:iconSprite];</p>
<p>        // WORKS FINE<br />
        UIImage* testImage = [UIImage imageNamed:@"Icon.png"];<br />
        CCSprite* testImageSprite = [CCSprite spriteWithCGImage:[testImage CGImage] key:@"testImageKey"];<br />
        testImageSprite.position = ccp(60,60);<br />
        [self addChild:testImageSprite];</p>
<p>        // DISPLAYS NOTHING - sourceImage is from a UIImagePickerController<br />
        CCTexture2D* texture = [[CCTexture2D alloc] initWithImage:sourceImage];<br />
        CCSprite* sprite = [CCSprite spriteWithTexture:texture];<br />
        [self addChild:sprite];<br />
        [texture release];`</p>
<p>The only glaring difference I see when inspecting the UIImagePickerController's returned image is that it's premultipied alpha settings are different.  Any ideas?
</p></description>
		</item>
		<item>
			<title>geertjan88 on "Simple mirror in cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/17452#post-98153</link>
			<pubDate>Thu, 09 Jun 2011 09:21:15 +0000</pubDate>
			<dc:creator>geertjan88</dc:creator>
			<guid isPermaLink="false">98153@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi, i would like to have a simple mirror in my app. So just simply a box were it shows what the front camera sees, but i cannot make it happend. I almost done it with UIImagePickerController inside a UIPopoverController but i cannot change the size which i really need to do. Also i think their should be an easier way to simply show the camera view in a certain box. Any help will be much appreciated
</p></description>
		</item>
		<item>
			<title>praveencastelino on "isometric projection for non tilemap game"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/17973#post-100836</link>
			<pubDate>Fri, 24 Jun 2011 14:46:06 +0000</pubDate>
			<dc:creator>praveencastelino</dc:creator>
			<guid isPermaLink="false">100836@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm new to cocos2d. I'm developing a 2D non-tilemap game. I need to setup up a projection or camera angle which is similar to the projection setup in isometric tilemap game.  What changes do I need to do?
</p></description>
		</item>

	</channel>
</rss>

