<?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: coordinate - Recent Topics</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/coordinate</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:18:25 +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/coordinate/topics" rel="self" type="application/rss+xml" />

		<item>
			<title>hima on "How to find a on-screen location of a CC3Node?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19730#post-110475</link>
			<pubDate>Sat, 13 Aug 2011 05:24:20 +0000</pubDate>
			<dc:creator>hima</dc:creator>
			<guid isPermaLink="false">110475@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Is there a way to find a screen location of a CC3Node? Unity3D has one and it's really convenient. Maybe there already is something like this but I couldn't find it from the source code :(
</p></description>
		</item>
		<item>
			<title>benji on "Transfer a rotation in another coordinate system"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/17920#post-100607</link>
			<pubDate>Thu, 23 Jun 2011 15:38:21 +0000</pubDate>
			<dc:creator>benji</dc:creator>
			<guid isPermaLink="false">100607@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi everyone,</p>
<p>I have a mesh loaded from a pod file and displayed in 3D using cocos3D. I would like to allow the user to rotate this object by sliding his finger on the screen. What I would like to do is to express a rotation in an arbitrary coordinate system where the x and y axis define a plan parallel to the screen of the phone and then transfer this rotation in the coordinate system of the mesh.<br />
Is there a clever way to do this in cocos3D without having to do all the trigonometry myself ?</p>
<p>Have a good day !
</p></description>
		</item>
		<item>
			<title>jiaren on "How to get co-ordinate in scaled Tilemap?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/11308#post-64042</link>
			<pubDate>Mon, 22 Nov 2010 03:12:45 +0000</pubDate>
			<dc:creator>jiaren</dc:creator>
			<guid isPermaLink="false">64042@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all,</p>
<p>Thank you every one for sharing knowledge in creating games - - I've learned a lot from this forum. I could find nearly every answer if I got any problem. However, it looks like no such topic covered yet for how to find the coordinate for a scaled Tiledmap.</p>
<p>Normally, I can use below function to get oordinate,</p>
<p>- (CGPoint)tileCoordForPosition:(CGPoint)position InMap:(CCTMXTiledMap *)map {<br />
	int x = position.x / map.tileSize.width;<br />
    int y = ((map.mapSize.height * map.tileSize.height) - position.y) / map.tileSize.height;</p>
<p>    return ccp(x, y);<br />
}</p>
<p>Could any expert here tell me how to sort it out in a scaled map? </p>
<p>Here I only apply scale in Y axis.</p>
<p>Thanks in advance.
</p></description>
		</item>
		<item>
			<title>horseshoe7 on "non-trivial coordinate system problem"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/9580#post-55130</link>
			<pubDate>Tue, 14 Sep 2010 15:59:48 +0000</pubDate>
			<dc:creator>horseshoe7</dc:creator>
			<guid isPermaLink="false">55130@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello,</p>
<p>Related to <a href="http://www.cocos2d-iphone.org/forum/topic/9568">this post.</a></p>
<p>I want to subclass a CCLayer so I can override the visit method with my own openGL code that makes use of a custom camera object.</p>
<p>I am getting seriously confused with how the various coordinate systems are working.</p>
<p>For now, I'll keep everything in PORTRAIT mode, so we avoid confusion.</p>
<p>I'll just write down what I did and hopefully an expert can point out what I did wrong.</p>
<p>- Created a layer, then added an oversized (bigger than 320x480) image as a child.  Cocos2D sets the anchor point of this image to the center of it, so I reset it's anchor to 0,0 before adding it as a child.</p>
<p>- When running the scene, I received what I expected.  the bottom left of my image was at the bottom left of the screen.  Makes sense.  i haven't messed with anything yet.</p>
<p>- I added as a member of the layer, a "Camera" object, that basically keeps track of 3 floats - camX, camY, zoom.  When initializing this, I set it's X,Y = (0,0) and it's zoom to 1.0 (100%).</p>
<p>- then I overrode the visit method:<br />
<pre><code>-(void)visit{
	CGSize screenDims = [[CCDirector sharedDirector] displaySize]; // autorotation not dealt with here.  You will have to deal with that yourself.
	CGPoint camPos = [[controller gameCam] position];  // MyGameLayer keeps a pointer to its Scene Controller, i.e. [self parent] will also work.
	float camZoom = [[controller gameCam] zoom];
	[[CCDirector sharedDirector] setProjection:kCCDirectorProjectionCustom];
	//now set your projection
	glMatrixMode(GL_PROJECTION);
	//save current projection state
	glPushMatrix();
	glLoadIdentity();
	glOrthof(camPos.x -screenDims.width/(2*camZoom),
			 camPos.x +screenDims.width/(2*camZoom),
			 camPos.y +screenDims.height/(2*camZoom),
			 camPos.y -screenDims.height/(2*camZoom),
			 -1000,
			 1000);
	glMatrixMode(GL_MODELVIEW);

	[super visit];

	//put it back
	glMatrixMode(GL_PROJECTION);
	glPopMatrix();
	glMatrixMode(GL_MODELVIEW);
}</code></pre>
<p>Now, I thought the result of this would be the bottom left corner of my image being located at the centre of the screen, since I wanted to look at 0,0.  The result was that the top left corner of the image was displayed at the top left of the screen.</p>
<p>I am totally confused and have no idea what's going on behind the scenes.</p>
<p>I have worked with basic openGL before with C++.  Creating viewports, creating and placing cams, etc.  I'm probably missing a few key bits of information that give me the whole  picture.</p>
<p>Any help would be great!  I'm absolutely stuck on this one.
</p></description>
		</item>
		<item>
			<title>hm50 on "Need some inspiration for throwing objects..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/8228#post-47864</link>
			<pubDate>Mon, 26 Jul 2010 17:44:46 +0000</pubDate>
			<dc:creator>hm50</dc:creator>
			<guid isPermaLink="false">47864@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello All.  I am looking for a better, more gamer friendly way of throwing an object in my game. </p>
<p>I have a horizontally scrolling tilemap.<br />
The player needs to throw an object to hit a target.<br />
Currently, when the player throws the object I have the X and Y ending coord for the thrown object hard coded, so that the thrown object always goes to (player.position.x+100, 150).  I use 150 because that is where I have my targets arranged (all at 150 Y). </p>
<p>I want to add other targets at different Y values. </p>
<p>The game is somewhat fast paced (scrolling speed), the player is moved via a joystick and objects are thrown with a button press. </p>
<p>I am looking for a way for the player to select a target prior to throwing. </p>
<p>I am thinking I could use a second "target selection" button, what do you think?</p>
<p>The issue is then, how do I know when a tile with a particular GID is on the screen so that I can set it as a possible target?</p>
<p>Due to animations, sound effects, and a large tilesheet I am already taking a sizable FPS hit, so I need to keep it somewhat simple.</p>
<p>Thanks for any help you can give!</p>
<p>HM50
</p></description>
		</item>
		<item>
			<title>liwenqiu on "the origin point of GL-&gt;UI problem"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7358#post-43134</link>
			<pubDate>Thu, 24 Jun 2010 04:36:42 +0000</pubDate>
			<dc:creator>liwenqiu</dc:creator>
			<guid isPermaLink="false">43134@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hello everyone, im newbie to cocos2d for iphone, i studying develop iphone game, but there is problem of UI coordinate confused me,  i known the UI's origin point is left top corner, but in convertToUI function, why it assumed the left bottom corner as the origin,  when i hold the iphone as OrientatonPortrait.
</p></description>
		</item>
		<item>
			<title>amatig on "Find Tile in isometric tilemap"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2988#post-18468</link>
			<pubDate>Sat, 14 Nov 2009 00:06:37 +0000</pubDate>
			<dc:creator>amatig</dc:creator>
			<guid isPermaLink="false">18468@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hello, if i have orthogonal map is easy, but if i have an isometric tilemap how i can get a GID of tile?<br />
the tile is a rhombus not a square :(
</p></description>
		</item>
		<item>
			<title>JavaWizKid on "CCSprite in Array"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4026#post-24111</link>
			<pubDate>Sun, 24 Jan 2010 01:29:55 +0000</pubDate>
			<dc:creator>JavaWizKid</dc:creator>
			<guid isPermaLink="false">24111@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>How can I get access to information of the CCSprite inside of an array such as x and y positions?<br />
This is my code at the moment and it returns the values of 0 all the time and I don't know why.</p>
<p>		for(int i = 0; i &#60; 10; i++)<br />
		{<br />
			[bulletsBuilder addObject: [CCSprite spriteWithFile:@"bullet.png"]];<br />
		}</p>
<p>			if(bulletNumber &#60; 10)<br />
			{<br />
				((CCSprite *)[bulletsBuilder objectAtIndex:bulletNumber]).position = ccp(blob.position.x, blob.position.y);<br />
				[self addChild:((CCSprite *)[bulletsBuilder objectAtIndex:bulletNumber])];<br />
				NSLog(@"X Position: %i", ((CCSprite *)[bulletsBuilder objectAtIndex:bulletNumber]).position.x); // Returns 0 for some reason<br />
				NSLog(@"Y Position: %i", ((CCSprite *)[bulletsBuilder objectAtIndex:bulletNumber]).position.y); // Returns 0 for some reason<br />
				bulletNumber++;<br />
			}</p>
<p>Thanks.
</p></description>
		</item>
		<item>
			<title>JavaWizKid on "How to track ccsrpite images in an array?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4024#post-24093</link>
			<pubDate>Sat, 23 Jan 2010 20:48:16 +0000</pubDate>
			<dc:creator>JavaWizKid</dc:creator>
			<guid isPermaLink="false">24093@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>for(int i = 0; i &#60; 10; i++)<br />
		{<br />
			[bulletsBuilder addObject: [CCSprite spriteWithFile:@"bullet.png"]];<br />
		}</p>
<p>			if(bulletNumber &#60; 10)<br />
			{<br />
				CCSprite *bul = [bulletsBuilder objectAtIndex:bulletNumber];<br />
				bul.position = ccp(blob.position.x, blob.position.y);<br />
				[self addChild:bul];<br />
				bulletNumber++;<br />
			}</p>
<p>How do I track certain items in the bulletsBuilder array? I want to check if any of their x positions are larger than say 480.</p>
<p>Is there a better way to create bullet arrays?</p>
<p>Thanks.
</p></description>
		</item>
		<item>
			<title>h.hamm on "CCSprite texturemapping : how to cycle UV-Coordinates ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4000#post-23994</link>
			<pubDate>Fri, 22 Jan 2010 14:41:44 +0000</pubDate>
			<dc:creator>h.hamm</dc:creator>
			<guid isPermaLink="false">23994@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I want to cycle through texture coordinates like : all pixels of the texture are scrolling via u-coordinate out of the sprite and comming back from the right.<br />
In States with three Pixels named 1, 2 and 3 its like :<br />
&#60;- [123] &#60;- u = 0.0<br />
&#60;- [231] &#60;- u = 0.333<br />
&#60;- [312] &#60;- u = 0.667<br />
&#60;- [123] &#60;- u = 1.0</p>
<p>in CCSprite I added a "setTextureCoordinates" function :<br />
-(void) setTextureCoordinatesBL:(CGPoint)bl BR:(CGPoint)br TL:(CGPoint)tl TR:(CGPoint)tr<br />
{<br />
	quad_.bl.texCoords.u = bl.x;<br />
	quad_.bl.texCoords.v = bl.y;<br />
	quad_.br.texCoords.u = br.x;<br />
	quad_.br.texCoords.v = br.y;<br />
	quad_.tl.texCoords.u = tl.x;<br />
	quad_.tl.texCoords.v = tl.y;<br />
	quad_.tr.texCoords.u = tr.x;<br />
	quad_.tr.texCoords.v = tr.y;<br />
	[selfRenderTextureAtlas_ updateQuad:&#38;quad_ atIndex:0];<br />
}</p>
<p>The Texture is moving as expected but the pixeles are not comming backin from the right side:</p>
<p>&#60;- [123] &#60;- u = 0.0<br />
&#60;- [23 ] &#60;- u = 0.333<br />
&#60;- [3  ] &#60;- u = 0.667<br />
&#60;- [   ] &#60;- u = 1.0</p>
<p>So I guess its because CCSprites loads its texture via GL_CLAMP_TO_EDGE. In my case it should be GL_REPEAT. Where could I say how to load a texture ?</p>
<p>in CCTexture2D I found this :<br />
-(void) setAliasTexParameters<br />
{<br />
	ccTexParams texParams = { GL_NEAREST, GL_NEAREST, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE };<br />
	[self setTexParameters: &#38;texParams];<br />
}</p>
<p>-(void) setAntiAliasTexParameters<br />
{<br />
	ccTexParams texParams = { GL_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE };<br />
	[self setTexParameters: &#38;texParams];<br />
}</p>
<p>so it seems that Textures ALWAYS loaded in clamped... </p>
<p>any suggestions?
</p></description>
		</item>

	</channel>
</rss>

