Quaternion rotation is inverse of what I expect I'm trying to learn quaternions and decided to implement my own quaternion class. To test it I made a couple vertex shaders, one that gets a model matrix (calculated from the quaternion) and another that gets the rotation quaternion directly and rotates vertices in shader. I then feed these a quaternion that rotates around the Y axis t 10000 radians (t time) const rotation Quat.fromAxisAngle(new Vec3( 0, 1, 0 ), t 10000) The result surprises me because my model is rotating counter clockwise but I expected it to rotate clockwise, since the angle is increasing (checked it, quat's xyz increase with time). Rotation around the X or Z axes is also backwards. All translations as well as matrix rotations work as expected in my coordinate system. I suspect my formulas are wrong, and probably assume Z is forward. If I transpose my model matrix (or post multiply with it) it rotates as expected, which suggests it's a handedness problem. Where are my formulas wrong and how can I understand the math behind this? Details My matrices are column major in memory (to match GLSL's mat4). My coordinate system is X right, Y up, Z forward. My code Quaternion from axis angle function fromAxisAngle(axis Vec3, angle number, dest new Quat()) Quat angle 0.5 const sin Math.sin(angle) dest.x axis.x sin dest.y axis.y sin dest.z axis.z sin dest.w Math.cos(angle) return dest Note I noticed if I negate this quaternion's x, y and z, everthing works as expected. Is this the root cause? I thought quaternions didn't have handedness! Since this is actually just inverting the quaternion (and thus its rotation) I'm afraid I'm just patching over the root cause. I don't want to patch the issue, I want to fix my math! Matrix from quaternion toMat4(dest new Mat4()) Mat4 const x, y, z, w this const x2 x x const y2 y y const z2 z z const xx x x2 const xy x y2 const xz x z2 const yy y y2 const yz y z2 const zz z z2 const wx w x2 const wy w y2 const wz w z2 Notice matrix is column major Source https en.wikipedia.org wiki Quaternions and spatial rotation Quaternion derived rotation matrix dest.init( 1 (yy zz), xy wz, xz wy, 0, xy wz, 1 (xx zz), yz wx, 0, xz wy, yz wx, 1 (xx yy), 0, 0, 0, 0, 1, ) return dest Matrix vertex shader precision mediump float attribute vec3 aVertexPosition attribute vec2 aVertexUV uniform mat4 uModelMatrix uniform mat4 uViewMatrix uniform mat4 uProjectionMatrix varying vec2 vUV void main(void) vUV aVertexUV gl Position uProjectionMatrix uViewMatrix uModelMatrix vec4(aVertexPosition.xyz, 1.0) Quaternion vertex shader precision mediump float attribute vec3 aVertexPosition attribute vec2 aVertexUV struct Transform float scale vec3 translation vec4 rotation uniform Transform uModel uniform Transform uView uniform mat4 uProjection varying vec2 vUV Source https twistedpairdevelopment.wordpress.com 2013 02 11 rotating a vector by a quaternion in glsl vec3 rotateVector(vec4 quat, vec3 vec) return vec 2.0 cross(cross(vec, quat.xyz) quat.w vec, quat.xyz) void main(void) vUV aVertexUV vec3 world rotateVector(uModel.rotation, aVertexPosition uModel.scale) uModel.translation vec3 view rotateVector(uView.rotation, world uView.scale) uView.translation gl Position uProjection vec4(view, 1.0)


I'm rotating an object on two axes, so why does it keep twisting around the third axis? I see questions come up quite often that have this underlying issue, but they're all caught up in the particulars of a given feature or tool. Here's an attempt to create a canonical answer we can refer users to when this comes up with lots of animated examples! ) Let's say we're making a first person camera. The basic idea is it should yaw to look left amp right, and pitch to look up amp down. So we write a bit of code like this (using Unity as an example) void Update() float speed lookSpeed Time.deltaTime Yaw around the y axis using the player's horizontal input. transform.Rotate(0f, Input.GetAxis("Horizontal") speed, 0f) Pitch around the x axis using the player's vertical input. transform.Rotate( Input.GetAxis("Vertical") speed, 0f, 0f) or maybe Construct a quaternion or a matrix representing incremental camera rotation. Quaternion rotation Quaternion.Euler( Input.GetAxis("Vertical") speed, Input.GetAxis("Horizontal") speed, 0) Fold this change into the camera's current rotation. transform.rotation rotation And it mostly works, but over time the view starts to get crooked. The camera seems to be turning on its roll axis (z) even though we only told it to rotate on the x and y! This can also happen if we're trying to manipulate an object in front of the camera say it's a globe we want to turn to look around The same problem after a while the North pole starts to wander away to the left or right. We're giving input on two axes but we're getting this confusing rotation on a third. And it happens whether we apply all our rotations around the object's local axes or the world's global axes. In many engines you'll also see this in the inspector rotate the object in the world, and suddenly numbers change on an axis we didn't even touch! So, is this an engine bug? How do we tell the program we don't want it adding extra rotation? Does it have something to do with Euler angles? Should I use Quaternions or Rotation Matrices or Basis Vectors instead?


Godot Quaternion slerp is altering initial rotation of an object I have a player that shoots a rocket. If the rocket has a target, I use a quaternion slerp to make it home in on that target. Free firing the rocket goes directly forwards as expected. Setting a tracking speed of 1 homes directly towards the target as expected. But for some reason if I set tracking speed to less than 1, the rocket's initial direction becomes (0 0, 1) no matter where the ship is pointing and then proceeds to rotate towards the target. Code below. var transformed rotation Transform global transform.looking at(target.global transform.origin, Vector3.UP) var new rotation Quat Quat(global transform.basis).slerp(transformed rotation.basis, tracking speed) set global transform(Transform(new rotation, global transform.origin))


Does gimbal lock occur only when a combination of local and world rotation axis are used? In all the explanations I've seen of gimbal lock, they always refer to the fact that when performing a series of rotations on all axes, it is possible that one rotation might end up aligning an axis with another which causes us to lose a degree of freedom. This never made sense to me since a rotation around e.g. the LOCAL RIGHT axis will rotation the whole LOCAL BASIS, no alignment happens. The only explanation I've seen that made sense was this one by DMGregory where it clearly explains that gimbal lock occurs when we e.g. change the yaw using the local basis and the pitch using a world basis. My question is Is that the only scenario where gimbal lock occurs or am I missing something? I also thought that quaternions help avoid gimbal lock but again, I'm missing something here because it seems to occur regardless of the rotation representation method (euler quaternion).


What is an efficient way to get a look at direction from either a quaternion or a transformation matrix? So, I have an object in my custom engine (C ), with a column major transform in world space. I'm using a package that takes a look at direction as an input. What's the most efficient way to get a look at direction from this transform? Do I extract the rotation matrix? Do I try to extract a quaternion?


How to expand the limit of screen mouse access for FPS side rotation I started coding in Godot and i have a working FPS controller but the problem is that when i move my mouse sideways , it cannot move my sight beyinid that side of my screen , in other words the movement of my charecter is limited by the size of my screen , how to prevent this Rotation code func input(event) if event is InputEventMouseMotion head.rotate y(deg2rad(event.relative.x mouseSensitivity)) camera.rotate x(deg2rad(event.relative.y mouseSensitivity))


from normal to rotation matrix (i'm on OPENGL) i have a mesh O (object) and a mesh T (terrain). i know a single triangle in T and i want to orient O to be aligned to that triangle (torate O to align to T in that point). i have only the normal in the triangle. how can i achive the roation matrix? i have thought this algorithm pseudocode float normal2rotation(Vector3D normal) angleX Vector3D.angleBetween(normal, Vecto3D.Axis3D.X) angleY Vector3D.angleBetween(normal, Vecto3D.Axis3D.Y) angleZ Vector3D.angleBetween(normal, Vecto3D.Axis3D.Z) float result angleX, angleY, angleZ return result but it does not give me the desired result.


How can I keep the clicked point under the mouse when rotating? (GLM) I have a spherical mesh of radius 1, centered at (0,0,0) in world coordinates. I want to rotate the sphere so that the clicked point remains under the mouse at all times. However, I cannot find an algorithm that does this. The clicked point always drifts away from the mouse. My current algorithm does the following Cast a ray to a sphere of radius 1. Find intersection point in world coordinates (Pa). After the mouse is moved, cast another ray and find a new intersection point. (Pb) since both those 3D points are on a sphere of radius one, centered at the origin, they should have length 1 but just in case I normalize them both. Find the rotation axis by doing Pa x Pb. Normalize the resulting axis axis glm cross(Pa,Pb) axis glm normalize(axis) Find the angle by doing arccosine on the dot product float angle glm acos(glm dot(Pa,Pb)) Build a rotation matrix from the axis and angle mat4 rotation glm rotate(glm degrees(angle),axis) lt This was the mistake glm degrees is not needed Multiply the existing model matrix by that calculated matrix modelMatrix rotation modelMatrix The rotations are correct but the clicked point does not stay under the mouse (I am checking by drawing a black square point on the sphere texture when the drag starts). If I click and drag to the right, the initially clicked point drifts to the left (lags).


Tank movement based on track speeds I want a system, where a tank moves and rotates based on the speeds I give him for the two tracks, for example, if I give the left track a speed of 1 and the right one a speed of 1, then I want the tank to stay still and rotate right, while if I give the left track 1 and the right track 0.5, I want it to rotate, but at the same time move forward Of course the speeds will be between 1 and 1


Rotating the playing field. (MonoGame) My maths isn't as good as it should be, I need to pick up some reference books on Trig. Could someone give me an idea of the maths if I wanted to revolve many sprites around a central point? It's a 2D system in MonoGame. I'm going to try to describe the scenario, I can't think of anything quite like it to reference. Imagine a game screen, you are looking down on the world, with my character in the middle, my character sprite will never change, but if I turn left or right I want everything else to rotate around the central point. Of course every sprite will have to be moved, and also rotate to account for the spin. Can someone point me in the right direction? Thanks.


How do I rotate shoulder bone up and down using Rotate and Space.World independend on model orientation I wanted to move my character's arms up and down in a straight way. The Rotation Gizmo tool can do exactely that. Playing with the wheel of the Rotation Gizmo tool in the attached screenshot (marked with red arrows in my screenshot), I could move the arms down in a straight way I can do the same using the following script using System.Collections using System.Collections.Generic using UnityEngine public class MyPlayer MonoBehaviour public Transform Shoulder private Quaternion Rotation private float f 0f private void OnGUI() if (GUI.Button(new Rect(0, 70, 50, 30), quot quot )) f 1 Shoulder.Rotate( f, 0, 0, Space.World) This works perfectly fine, but no longer when I rotate the main model ( the parent of the shoulder). How could I make this script independend on the main transform's orientation? Thank you! Edit I would guess that I have to take the main transform ( parent) orientation into account in order to subtract its global rotation from the calculations, but not really knowing which values I should choose, I didn't find the correct formula. However, FYI, I tried the following using System.Collections using System.Collections.Generic using UnityEngine public class MyPlayer MonoBehaviour public Transform Shoulder public Transform Mother private float f 0f private void OnGUI() if (GUI.Button(new Rect(0, 70, 50, 30), quot quot )) f 1 f Mother.transform.rotation.eulerAngles.x Shoulder.Rotate( f, 0, 0, Space.World)


How do I determine the forward right direction when I have the "up" vector? Unity I am trying to fix a gameobject for e.g. a cube (which i am using as a sensor) on my character. I need the cube to rotate (with orientation control from the inspector I have a public quaternion rotation variable set). I have identified 3 vertices using ray cast to fix my sensor onto the character. I already have determined the normal of these vertices which will be the "up" direction of the cube. I am wondering how I can determine the forward right vector to use in the LookRotation() function. I need to basically be able to rotate the cube ON the character even as the character moves on animation. This is my code, and as of now there is no rotation happening. I'm sure I am missing something and would really appreciate help. I really hope this is enough explanation. using System.Collections using System.Collections.Generic using UnityEngine public class orientation MonoBehaviour importing from Vertex Finder Script to use InterpolatedNormalInWorldSpace value private VertexFinder script public Transform target to edit orientation of sensor in Unity Inspector public Quaternion rotation edit Start is called before the first frame update void Start() script GetComponent lt VertexFinder gt () Quaternion TurretLookRotation(Vector3 approximateForward, Vector3 exactUp) Quaternion rotateZToUp Quaternion.LookRotation(exactUp, approximateForward) Quaternion rotateYToZ Quaternion.Euler(90f, 0f, 0f) return rotateZToUp rotateYToZ Update is called once per frame void Update() Vector3 relativePos target.position transform.position aligning axes of sensor to z axis and y axis respectively Quaternion rotation1 TurretLookRotation(relativePos, script.interpolatedNormalInWorldSpace) setting rotation of sensor to values entered in Inspector with respect to the above aligned axes transform.rotation rotation1 rotation edit


Rotating Object parallel to other object I try to rotate objects in the same direction as a reference object. Normaly this would be easy object1.rotation reference.rotation But the same rotation can be expressed with different vectors (0, 45, 270) is the same as (0, 225, 90) (0, 0, 270) is the same as (0, 180, 90) In my case the final rotation should account for this. The reference object has a rotation of (0, 45, 270) Object1 Should Rotate from (0, 45, 270) to (0, 0, 270) Object2 Should Rotate from (0, 225, 90) to (0, 180, 90) How can i calculate this? Im using unity if this is any help.


Quaternion rotations transforms from global to local space I am trying to solve this problem and getting no where, could really use some assistance. Rotation is defined as X (rotate left right), Y(rotate up down), Z(roll) Coordinates are X Forward backward, Y Left right, Z up down I have two objects in simulated space, both have galactic coordinates (XYZ) and a quaternion representing their rotation. ObjectA Coordinates 0.593 0 0 (directly ahead of ObjB) RotationQuat w 0, x 1, y 0, z 0 (Rotated 180 yaw, facing backwards) ObjectB Coordinates 0 0 0 RotationQuat w 1, x 0, y 0, z 0 (No rotation, facing towards ObjA) Given the above information, how do I translate ObjA's location into ObjB's local space? If ObjA fires at ObjB (or vise versa), I need to calculate which side will be hit. Forward, Aft, Port, Starboard, Ventral or Dorsal. My project is written entirely in C. Actually this is an old project, created by someone else that I am converting to using quaternions due to gimbal lock. Any advice?


How do i make enemy tank to follow and face player tank? I'm creating tank game demo , in game i want enemy tank to always face toward the player tank. I already check look at() function but it will face immediately, i don't want that. I want enemy tank to slowly rotate toward player. What i'hv done so fare is MainWindow.gd extends Node2D func ready() Tank2.loadPlayer1( Tank1) pass EnemyTank.gd extends KinematicBody2D var rotSpeed 0.3 var player1 var speed 30 var velocity Vector2() func ready() pass func loadPlayer1(obj) player1 obj func process(delta) if player1 ! null velocity Vector2() var rot dir (player1.position position).angle() rotation rotSpeed rot dir delta velocity Vector2(0,0).rotated(rotation) move and slide(velocity) pass My Result is Enemy Tank (red) keep rotating Does anyone know how do i fix this? Thank you


Rotating and pitching a turret I am new to game development and I was trying to build a turret model, and control it through lua script in shiva3d. I can rotate it around the y axis which is no problem, but when it comes to pitching, I am not sure how to do that in a way which is independent of the Y rotation, for example, in the default position, rotating with a positive value around X aims upwards, which is what I expect. when I rotate it by 180 degrees around Y, the positive rotation around X aims downwards towards the ground instead of upwards. on the other hand, if I rotate by 90 degrees, the turret rotates around it self as if its rolling... I am not sure what to look for in order to understand how rotation in a 3d world should happen, so any pointers on that would be much appreciated


Increasing the rotation angle on a quaternion makes the rotation stop at a certain angle I'm using the following code to change the rotation of an object Quaternion rot getRotation() setRotation(make quaternion axis angle(rot.v,rotationSpeed dt) rot) This code works as expected until a certain angle where it suddenly stops. Why does it stop?


Programmatically determine UVs by rotating a plane along X axis I'm having a math brainfart while trying to solve what might be a simple problem. I've got a plane in 3d space (it's actually the face of a 10 sided die) Coordinates x,y,z Point top 0,0,1 Point left Sin (2pie9 10), Cos(2pie9 10), 0.1 .5878,.809,.1 Point right Sin (2pie 10) , Cos(2pie 10), 0.1 .5878,.809,.1 Point bot 1,0, 0.1 If you project that out, it's a plane with the top leaning back away from you, and the bottom closer to you. I'm trying to automatically build a UV map of that face to put a texture on, so think I should rotate it around the x asix so that it's only in 2D, then scale that to best fill up a 256x256 texture. I'm doing this in Three.JS for a canvas app. Is this the right approach? In this example http wecreategames.com games DiceBoard ( die creation code is in http wecreategames.com games DiceBoard die10.js ), I'm estimating the UVs by Build UVs scope.faceUvs scope.faceVertexUvs for (var f 0 f lt numHalfFaces f ) var faceuv new THREE.UV(.2, .6), new THREE.UV(.5, .75), new THREE.UV(.8, .6), new THREE.UV(.5, .2) scope.faceUvs 0 .push(new THREE.UV(0, 1)) scope.faceVertexUvs 0 .push(faceuv) But when I view on an iPhone or Android, it shows weird screen artifacts... I'm thinking because the UVs aren't exact. I think I'd apply some function like this (where andDist is an angle) rx x ry (y Math.cos(angDist)) (z Math.sin(angDist)) rz (y Math.sin(angDist)) (z Math.cos(angDist)) But, I'm not sure how to get the angle that the face is inclined at. Any suggestions? Or, are those white screen artifacts due to something else I've overlooked?


Get 3D quad rotation matrix from points I have 4 3D points which represent a even quad in space. (So 3 points are sufficient) I need to get all the individual transformations (translation, rotation, dimensions) so that I can build that quad in my CSS 3D engine. So the default normal vector for a quad is 0, 0, 1 . What I have so far 4 points p0, p1, p2, p3 normal normal cross(p1 p0, p2 p0) axis and angle axis cross( 0, 0, 1 , normal) angle arccos(dot( 0, 0, 1 , normal)) rotation matrix rotationMatrix matrix4.fromAxisAngle(axis, angle) width and height width sqrt((p2.x p1.x) 2, (p2.y p1.y) 2, (p2.z p1.z) 2) height sqrt((p1.x p0.x) 2, (p1.y p0.y) 2, (p1.z p0.z) 2) translation x (p0.x p1.x p2.x p3.x) 4 y (p0.y p1.y p2.y p3.y) 4 z (p0.z p1.z p2.z p3.z) 4 It almost works, but some rotations are wrong or more specifically one rotation axis is missing. This is logical because the rotation is only build from the normal. So how can I get the full rotation? Here you see that the top and bottom quads are just rotated around the x axis but the y axis rotation is missing


How to map absolute Joystick position to object rotation? In my (Ogre) 3d scene I have an object that should be rotated locally based on Joystick input. I have a Joystick with min max values of 32767, 32767 on both X and Y axes. When the Joystick is in its origin position, the object should not be rotated. When the user moves the Joystick, the object in the 3d scene should follow this movement (or better orientation) up to a max. of 45 degrees on both axes. Or in other words when the user moves the Joystick e.g. fully to the left, the object's orientation in the 3d scene should be set to 45 degrees on the according axis. Being new to 3d programming I searched on the Internet on how to achieve this. I think to understand that I want to use Quaternions for this task. I found some examples and tutorials on how to use Quaternions for rotating objects. What I don't understand though is how I can map from the Joystick's current absolute axes positions to the absolute, local rotation of an object. I see that I could use the rotate() method of the object's node to set its rotation, but I understand that this rotates the object relatively to it's current position. But instead I want to map from the Joystick's absolute position to the absolute orientation rotation of the object in the scene. Any advice how I should approach this?


Calculate quaternion rotations between two values I have a quaternion Q1 X 0.023995593190193176 Y 0.4076451063156128 Z 0.04357096180319786 W 0.9117847681045532 and I have a keyframe value Q2 which is based on Q1 X 0.176469 Y 0.368251 Z 0.479782 W 0.776569 Now my question is how can I get the correct keyframe values if there would be no extra start values ? I mean if Q1 is 1,0,0,0 (w,x,y,z). (no extra start values) So basically I need to rotate my object to the same pose but from the default values (1,0,0,0) start not from Q1.


What is an efficient way to get a look at direction from either a quaternion or a transformation matrix? So, I have an object in my custom engine (C ), with a column major transform in world space. I'm using a package that takes a look at direction as an input. What's the most efficient way to get a look at direction from this transform? Do I extract the rotation matrix? Do I try to extract a quaternion?


how to properly rotate in directX11 I am trying to Rotate a textured quad in directX however I think i am missing something. I am pretty sure it is because i am applying transformations to the WorldMatrix instead of the ObjectWorld, however i do not have an object world matrix so i am unsure how i would get that since i am not storing much except the texture and the position of 4 vertices directly to the buffer and only updated when it is needed. here is what i have tried bool GraphicsClass Render(float deltatime) D3DXMATRIX worldMatrix, viewMatrix, projectionMatrix, orthoMatrix, rotationZ bool result Clear the buffers to begin the scene. m D3D gt BeginScene(0.0f, 0.0f, 0.0f, 0.0f) Generate the view matrix based on the camera's position. m Camera gt Render() DrawingStuff Get the world, view, projection, and ortho matrices from the camera and d3d objects. m Camera gt GetViewMatrix(viewMatrix) m D3D gt GetWorldMatrix(worldMatrix) m D3D gt GetProjectionMatrix(projectionMatrix) m D3D gt GetOrthoMatrix(orthoMatrix) Transform World Matrix with a rotation matrix D3DXMatrixRotationZ( amp rotationZ, 90.0f) D3DXMatrixMultiply( amp worldMatrix, amp worldMatrix, amp rotationZ) Turn off the Z buffer to begin all 2D rendering. m D3D gt TurnZBufferOff() Put the bitmap vertex and index buffers on the graphics pipeline to prepare them for drawing. result m Bitmap gt Render(m D3D gt GetDeviceContext(), 124, 124) if(!result) return false Render the bitmap with the texture shader. result m TextureShader gt Render(m D3D gt GetDeviceContext(), m Bitmap gt GetIndexCount(), worldMatrix, viewMatrix, orthoMatrix, m Bitmap gt GetTexture()) if(!result) return false Turn the Z buffer back on now that all 2D rendering has completed. m D3D gt TurnZBufferOn() Present the rendered scene to the screen. m D3D gt EndScene() return true the full code can actually be downloaded from http www.rastertek.com dx11tut05.html with the minor difference that render takes in delta time since last frame using a custom timer class which is not provided by them as well as a few minor tweaks but it is mostly the same. i did find this http www.rastertek.com dx11tut25.html which i may try to implement however that is not really what i want, i want to rotate the actual quad, not the texture.


Euler adjustments between two quaternions I have two quaternions, q1 and q2. If my object's current rotation is at q1, but I need to get it to q2, what would be the process to figure out how much rotation I apply to x, y, and z in order to get there? In this example, x right, y up, z forward I've tried getting the delta between the two quaternions and unwrapping that into Eulers and moving the x, y, z the amount of the unwraped Vector3f, but that does not seem to give the correct values. Current implementation in pseudo code var dQuat Quaternion.Inverse(prevRotation) target.rotation dChange dQuat.eulerAngles This approach gives me only positive changes. If I rotate forward on x, I get positive lower numbers and if I rotate backwards on x, I get larger positive numbers. I'm looking for, in order to get to q2 from q1, rotate n degrees along your x, y, z... Thanks in advance for any help!


Rotate around an axis function for euler angles representation For a 3d game i need a function to rotate an euler representation around an arbitary axis by an angle. For example an object is rotated with euler angles (0,90,0). Now the object should be rotated by 100 degrees around the axis (0,1,0). The resulting angle will be (0,190,0) using rotation order YXZ. In this case I can add the angle to the euler value of the axis, however for an arbitary axis this will not work. Problem with Quaternions amp Rotation matrices With these representations the resulting rotations will always be smaller that 180 for each axis. I need the rotation to be lerped afterwards for example from (0,0,0) to (0,720,0). Basically I am searching for a way to display euler angles like most of the 3D editors. When you rotate an object around any arbitary axis rotation might be larger than 360 in the editor, like (420,720,15).


How can I modify the UV co ordinates on a texture so they converge to a point? I'm building a roof visualiser app, where someone can take a picture of their roof, define its outline, then visualise a new roof texture on it. I'm generating a 3D plane that matches the roof outline points, but I'd like the 3D planes material's UV's to match the perspective of the existing roof (i.e the lines converge into the distance as they move away from the user. Is this possible? The alternative solution is to figure out how to rotate the generated 3D plane to match the roof outline points, while matching the perspective too, but I'm thinking this may be more complicated. Step 1 Define roof oultine with points Step 2 Texture 3D plane with UV's mapped to maintain roof perspective based on slant defined in the 4 points Any tips on how to solve this?


Find out which way to rotate based on current rotation and final rotation I have one object that I want to rotate to a certain angle with 'smooth' rotation. I looked up on how to solve that and I came up with this enter image description here But how do I know in what way to rotate, positive or negative? According the the picture on ex. 1, I need to rotate positively because it is the closest way for me to rotate. And on the second it is the negative way. But how do I know this? I've tried several solutions but I can't seem to find anything that is correct.


Arcball Problems with UDK I'm trying to re create an arcball example from a Nehe, where an object can be rotated in a more realistic way while floating in the air (in my game the object is attached to the player at a distance like for example the Physics Gun) however I'm having trouble getting this to work with UDK. I have created an LGArcBall which follows the example from Nehe and I've compared outputs from this with the example code. I think where my problem lies is what I do to the Quaternion that is returned from the LGArcBall. Currently I am taking the returned Quaternion converting it to a rotation matrix. Getting the product of the last rotation (set when the object is first clicked) and then returning that into a Rotator and setting that to the objects rotation. If you could point me in the right direction that would be great, my code can be found below. class LGArcBall extends Object var Quat StartRotation var Vector StartVector var float AdjustWidth, AdjustHeight, Epsilon function SetBounds(float NewWidth, float NewHeight) AdjustWidth 1.0f ((NewWidth 1.0f) 0.5f) AdjustHeight 1.0f ((NewHeight 1.0f) 0.5f) function StartDrag(Vector2D startPoint, Quat rotation) StartVector MapToSphere(startPoint) function Quat Update(Vector2D currentPoint) local Vector currentVector, perp local Quat newRot Map the new point to the sphere currentVector MapToSphere(currentPoint) Compute the vector perpendicular to the start and current perp startVector cross currentVector Make sure our length is larger than Epsilon if (VSize(perp) gt Epsilon) Return the perpendicular vector as the transform newRot.X perp.X newRot.Y perp.Y newRot.Z perp.Z In the quaternion values, w is cosine (theta 2), where theta is the rotation angle newRot.W startVector dot currentVector else The two vectors coincide, so return an identity transform newRot.X 0.0f newRot.Y 0.0f newRot.Z 0.0f newRot.W 0.0f return newRot function Vector MapToSphere(Vector2D point) local float x, y, length, norm local Vector result Transform the mouse coords to 1..1 and inverse the Y coord x (point.X AdjustWidth) 1.0f y 1.0f (point.Y AdjustHeight) length (x x) (y y) If the point is mapped outside of the sphere ( length gt radius squared) if (length gt 1.0f) norm 1.0f Sqrt(length) Return the "normalized" vector, a point on the sphere result.X x norm result.Y y norm result.Z 0.0f else It's inside of the sphere Return a vector to the point mapped inside the sphere sqrt(radius squared length) result.X x result.Y y result.Z Sqrt(1.0f length) return result DefaultProperties Epsilon 0.000001f I'm then attempting to rotate that object when the mouse is dragged, with the following update code in my PlayerController. Get Mouse Position MousePosition.X LGMouseInterfacePlayerInput(PlayerInput).MousePosition.X MousePosition.Y LGMouseInterfacePlayerInput(PlayerInput).MousePosition.Y newQuat ArcBall.Update(MousePosition) rotMatrix MakeRotationMatrix(QuatToRotator(newQuat)) rotMatrix rotMatrix LastRot LGMoveableActor(movingPawn.CurrentUseableObject).SetPhysics(EPhysics.PHYS Rotating) LGMoveableActor(movingPawn.CurrentUseableObject).SetRotation(MatrixGetRotator(rotMatrix))


How do I get a relative rotation between two positions? For example, I have two objects a amp b. a's position is 12, 16, 2 and b's position is 14, 16, 3 I need to know how to find a relative rotation between them. By relative rotation I mean this a's pitch and yaw so a is looking at b. I have no helping methods like lookingAt() etc. I only know a's x,y,z,yaw,pitch and b's x,y,z. Any help?


Rotate an object around a point in Ogre3D Possible Duplicate How can I rotate about an arbitrary point in 3D (instead of the origin)? I am new to 3D programming and I have been using Ogre3D lately to get a grasp of it. What I am trying to do is the following I want to make an entity rotate around a point (probably the parent SceneNode) in a circular way only in the X and Z axis. I have tried using yaw pitch roll and rotate but no luck, and I can't find any good tutorials how tos online.


THREE.JS why is the rotation only applied on the last axis used? my function function rotateAroundWorldAxis2(object, radians1, radians2) object.rotWorldMatrix.makeRotationX(radians1).makeRotationZ(radians2) object.rotWorldMatrix old code for Three.JS pre r54 rotWorldMatrix.multiply(object.matrix) new code for Three.JS r55 object.rotWorldMatrix.multiply(object.matrix) pre multiply object.matrix.copy( object.rotWorldMatrix ) old code for Three.js pre r49 object.rotation.getRotationFromMatrix(object.matrix, object.scale) old code for Three.js pre r59 object.rotation.setEulerFromRotationMatrix(object.matrix) code for r59 object.rotation.setFromRotationMatrix(object.matrix) my object was initialized like this object.rotWorldMatrix new THREE.Matrix4()


Projectile Rotation During Flight (Tank Game) I have a tank firing projectiles into the air. I want the projectiles to be rotated relative to their position along their flight path. See the diagram I drew in the image below. At any given point I know the x and y of the projectile, z represents initial velocity, theta is also known.


from normal to rotation matrix (i'm on OPENGL) i have a mesh O (object) and a mesh T (terrain). i know a single triangle in T and i want to orient O to be aligned to that triangle (torate O to align to T in that point). i have only the normal in the triangle. how can i achive the roation matrix? i have thought this algorithm pseudocode float normal2rotation(Vector3D normal) angleX Vector3D.angleBetween(normal, Vecto3D.Axis3D.X) angleY Vector3D.angleBetween(normal, Vecto3D.Axis3D.Y) angleZ Vector3D.angleBetween(normal, Vecto3D.Axis3D.Z) float result angleX, angleY, angleZ return result but it does not give me the desired result.


Convert quaternion to a different coordinate system OSVR has a right handed system x is right, y is up, z is near. I need to convert orientation data from a sensor in OSVR to a different right handed system in which x is forward, y is left, and z is up. I need to calculate the transformation that will convert a quaternion from one system to the other. I naively tried void osvrPoseCallback(const geometry msgs PoseStampedConstPtr amp msg) osvr to ros geometry msgs PoseStamped outputMsg outputMsg.header msg gt header outputMsg.pose.orientation.x msg gt pose.orientation.y outputMsg.pose.orientation.y msg gt pose.orientation.z outputMsg.pose.orientation.z msg gt pose.orientation.x outputMsg.pose.orientation.w msg gt pose.orientation.w osvrPosePub.publish(outputMsg) ros spinOnce() But that made things really weird. Facing north pitch is pitch, facing west, pitch is yaw, facing south, pitch is negative pitch... How can I convert my OSVR quaternion to the a corresponding quaternion in the new coordinate system?


Rotating and pitching a turret I am new to game development and I was trying to build a turret model, and control it through lua script in shiva3d. I can rotate it around the y axis which is no problem, but when it comes to pitching, I am not sure how to do that in a way which is independent of the Y rotation, for example, in the default position, rotating with a positive value around X aims upwards, which is what I expect. when I rotate it by 180 degrees around Y, the positive rotation around X aims downwards towards the ground instead of upwards. on the other hand, if I rotate by 90 degrees, the turret rotates around it self as if its rolling... I am not sure what to look for in order to understand how rotation in a 3d world should happen, so any pointers on that would be much appreciated


What are the app file size limitations for different smartphone OSes carriers? I know the iPhone App Store limits how large an app can be in general and there are also limitations with AT amp T over the size it can be to transmit over a data plan vs WiFi. I have no idea what, if any, these limits are for Android apps and what I'm finding online is a mix of different numbers. Does anyone know these numbers definitively? The Android game I'm porting is in the 20 30MB range and we'd like to know if we need to further reduce its size.


How to port a game from IPad to Iphone I just finished developing a 2D side scroll game for the IPad using Cocos2d and Box2d. Now we want to make an IPhone 4 version of the game, but I'm still not sure what is the best way to do it. I was thinking to just create a new target on my project, remove all the current resources from the Build Phases and create a new Resources folder with all the assets of the game scaled to the new resolution. Of course this approach would take a lot of work, specially from the designer, since there are a lot of images on the game, 30 levels with 3 layers of parallax, and over 100 animations between all the elements, plus the SVG levels that map physics world (we are using level SVG parser). I would also have to check all the touch functions and the sprites with a hard coded position (mostly Hud and the Menu). I did tried to use the win Size for this, but I'm pretty sure there are sprites with fixed positions. I know that checking the Menu and Hud position should not take much time, but I'm worried about the time it could take to scale all the images, and specially the SVG files that map the physics of the game. I would like to know if I'm in the right path regarding the porting of the game or if there if someone have though of a better easy solution. I tried modifying the gluLookAt eye z parameter, but this didn't work really well. I haven't work with OpenGL since college around 3 years ago, and I don't remember very well the math behind the low level pipeline of it. Anyway, I don't think that modifying the Cocos2d rendering steps could work for my problem.


Efficient Bullet Firing Class I've been struggling with this for a while. I have been trying to create a bullet pool class for a game I have made that doesn't cause a significant fps drop. I have tried creating a bullet pool and have also tried dynamically creating and deleting bullets, both of which drop the fps of the game around 10 15. I ran a test a few days ago and just put a return statement in the bullet pool's firebullet function, which represented the logic leading up to this, function calling, etc. This only dropped the fps 2 4. If I can fire bullets without dropping the fps more than another 2 3, I would be satisfied. My bullets are autorelease objects that are a subclass of a ccnode. I create a ccsprite and a box2d b2body for each one. I am working on the ios platform. Any thoughts on how to make this more efficient? Has anyone managed to do something similar to this?


Sound Delay With AVAudio Player I'm using the following code in my viewDidLoad to load a sound NSURL url NSURL fileURLWithPath NSString stringWithFormat " Moto Hit Sound.mp3", NSBundle mainBundle resourcePath NSError error hitSoundPlayer AVAudioPlayer alloc initWithContentsOfURL url error amp error hitSoundPlayer.numberOfLoops 0 Then I'm using this in a void method to play the sound if(CGRectIntersectsRect(main.frame, enemy1.frame)) hitSoundPlayer play This does seem to work, however the first time the sound is played there is a lot of lag and the game stops temporarily. I'm using this same method for when in an IBAction and it works fine, it must be the fact that it's also detecting a collision that makes the sound lag. If I want to be able to play sounds quickly and on the spot without any sort of lag am I doing the right thing? Do I want to use another method? I'm not using any frameworks like cocos2d. If you need to see any more code just ask.


Network client server message exchange and clock synchronization help i'm doing a fast paced physics game that is a table hockey. With two mallets and one puck. The game runs on iphone ipad and i'm doing the multiplayer part through GameCenter. This is how the network system works. The client wich stars the match, will be settled as the server and the one that accepts the match request is the client. The 'server' has the physics running and the response is immediate and the client also has their physics running so it looks smooth between messages exchange. What i do as the server, is that i send to the client my puck velocity and my position and the client adjusts his puck velocity position related to the server to keep it sync. Otherwise the physics desynchronizes and it screws it up. When the network latency is good, bellow 100ms the results are pretty good, i got a smooth playable game on the client side and the weird behavior are minimum. The problem happens when the lag is around 150 to 200ms. In that case, happens that my client puck already hitted a edge and inverted direction but it receives a delay message from the server and it backs a bit causing a weird feeling to the ball behavior. I've readed a few things about it Pong Network Example Click Synchronization Example Wikipedia on Clock Sync So, how can i solve this? As far as i've read the best option that i have is to do a clock synchronization on the server client with a timestamp so that when i get delay messages related to my clock, i just ignore then and let the clients simulation do the job. Do you guys agree with that? And since im sending data unreliable (UDP) i may get delayed messages or messages out of order. If that is the best approach, how do i implement the clock synchronization. I've read the steps on how to but i didn't quite understand it. It says that Client stamps current local time on a "time request" packet and sends to server. Upon receipt by server, server stamps server time and returns Upon receipt by client, client subtracts current time from sent time and divides by two to compute latency. It subtracts current time from server time to determine client server time delta and adds in the half latency to get the correct clock delta. (So far this algothim is very similar to SNTP) The client repeats steps 1 through 3 five or more times, pausing a few seconds each time. Other traffic may be allowed in the interim, but should be minimized for best results The results of the packet receipts are accumulated and sorted in lowest latency to highest latency order. The median latency is determined by picking the mid point sample from this ordered list. All samples above approximately 1 standard deviation from the median are discarded and the remaining samples are averaged using an arithmetic mean. Following this example i would have this Lets pretend the game has loaded and my client time is 0 now, so i send to the server that my time is 0. The messages takes 150ms to get to the server but the server's clock had already started and is 1 second ahead of the client. When the server get the message the time will be 1.15 and sends that time to client, are we good? Lets pretend our lag is constant at 150ms. Now the client receives the time 1.15 and subtracts current time from sent time and divides by two to compute latency. Wich is 0.3 0 0.3 2 150ms. It subtracts current time from server time to determine client server time delta and adds in the half latency to get the correct clock delta Client time 0.3 Server time 1.15 0.3 1.15 .85 latency(.15) 1 How is that synchronized? What am i missing? It's my first time on multiplayer and network experience, so i'm a bit confused. Thank you.


Best way to learn iphone game development? I know php and some python, but not much c. Where should I start to learn iphone game development? Is there some recommended books tutorials for beginners? I'm looking at using cocos2d but I'm open to anything that isn't too limited.


How to load a text file from a server into iPhone game with AS3 in Adobe AIR? Im creating an iPhone game with Adobe AIR, and I want to be able to load a simple text msg into an dynamic text box on the games front screen from my server (and then be able to update that text file on the server, so it updates automatically in the game after the game is on the app store) How would I go about acheiving that? is it as simple as using a getURL? are there any specifical issues with trying to do this on the iPhone via AIR that I should be aware of? Thanks for any advice.


What are the minimum requirements for UDK on iOS? Infinity Blade asks for 3GS or better devices, which I'm told is because it uses OpenGL ES 2. Will every game made with the iOS version of the UDK only work with 3GS devices and up?


Cocos2d pause game freezes the screen I am trying to create pause screen for my game. The game is developed upon continuous scrolling background (top to bottom) with obstacles which are moving independently (left to right). Below is the code PauseScene.h interface PauseScene CCNode property (nonatomic, retain) HelloWorldScene mainScene (PauseScene )scene (id) init end PauseScene.m implementation PauseScene (id) init if (self super init ) Adding RESUME and QUIT button and few others to make the whole Pause screen return self Called the method when Resume button is selected (void) Resume (id) sender CCDirector sharedDirector startAnimation CCDirector sharedDirector resume self.mainScene.userInteractionEnabled YES self.mainScene removeChild self self.mainScene StartGame StartGame in MainScene contains the same code which commented out above, I will paste StartGame method later Quit method is called when the Quit button is pressed (void) Quit (id) sender CCDirector sharedDirector resume CCDirector sharedDirector startAnimation self.mainScene.userInteractionEnabled YES self.mainScene removeChild self NSLog( "Pre Reload", nil) self.mainScene scheduleOnce selector(ReloadGame) delay 1.0f self.mainScene ReloadGame Reload method contains the code commented above end PauseScene is mere node class. StartGame and ReloadGame methods in MainScene file (void) StartGame Create and display HUD layer, like, scores, navigation buttons, etc. Resuming the game CCDirector sharedDirector stopAnimation CCDirector sharedDirector resume CCDirector sharedDirector startAnimation (void) ReloadGame Resume the game CCDirector sharedDirector stopAnimation CCDirector sharedDirector resume CCDirector sharedDirector startAnimation CCDirector sharedDirector replaceScene HelloWorldScene scene withTransition CCTransition transitionFadeWithDuration 1.0f The pause button is displayed in HUD layer of MainScene, so, when the pause button is clicked, we will pause the game and display the PauseScene (void)onPauseClicked (id)sender Code to display the pause node of this scene Pause the game CCDirector sharedDirector stopAnimation CCDirector sharedDirector pause When I comment out that stopAnimation and pause part the Pause and Resume works perfect. But when I implement any of these, at the time of quitGame, replaceScene is not working somehow. I think this is because game goes in pause mode but it is not working even if I call replaceScene using scheduler on delay of 5 10 seconds. And if I don't use these stopAnimation and pause, some sprites which are given CCAction are not being paused and goes on even when my game is paused. Your help is appreciated because I am using Cocos2d 3.0 and unable to find any proper help.


Using tilemaps for an isometric football game with cocos2dx I am writing a simple soccer game in cocos2d x and recently found out that older iOS versions do not support cocos2d sprites larger than 1024x1024px. I was thinking about using isometric tilemaps to create a larger football field. Is this the way to go ? If so, how can i convert a convert my 2048x2048px football field image into several isometric tiles ?


Help implementing virtual d pad Short Version I am trying to move a player around on a tilemap, keeping it centered on its tile, while smoothly controlling it with SneakyInput virtual Joystick. My movement is jumpy and hard to control. What's a good way to implement this? Long Version I'm trying to get a tilemap based RPG "layer" working on top of cocos2d iphone. I'm using SneakyInput as the input right now, but I've run into a bit of a snag. Initially, I followed Steffen Itterheim's book and Ray Wenderlich's tutorial, and I got jumpy movement working. My player now moves from tile to tile, without any animation whatsoever. So, I took it a step further. I changed my player.position to a CCMoveTo action. Combined with CCfollow, my player moves pretty smoothly. Here's the problem, though Between each CCMoveTo, the movement stops, so there's a bit of a jumpiness introduced between movements. To deal with that, I changed my CCmoveTo into a CCMoveBy, and instead of running it once, I decided to have it CCRepeatForever. My plan was to stop the repeating action whenever the player changed directions or released the d pad. However, when the movement stops, the player is not necessarily centered along the tiles, as it should be. To correctly position the player, I use a CCMoveTo and get the closest position that would put the player back into the proper position. This reintroduces an earlier problem of jumpiness between actions. What is the correct way to implement a smooth joystick while smoothly animating the player and keeping it on the "grid" of tiles? Edit It turns out that this was caused by a "Bug Fix" in the cocos2d engine.


CATiledLayer drawing delay I am developing an iphone app. It has following page structure, 1.List of game levels in a UITableView 2.Game page I use "UIViewAnimationTransitionFlipFromRight" between pages Game page has 3 views, One is a scrollView in that my game grid is drawn. Game grid is a sub class of UIView ,that added to Scrollview. To support zooming i use CATiledLayer to draw the grid(20 20). MY problem is GameGrid shows white or last played puzzles grid contents for a few seconds and then refresh(flashing) to the new content. My GameGrid class as follows implementation GameGrid (Class)layerClass return CATiledLayer class (id)initWithFrame (CGRect)frame if ((self super initWithFrame frame )) CATiledLayer tempTiledLayer (CATiledLayer )self.layer tempTiledLayer.levelsOfDetail 5 tempTiledLayer.levelsOfDetailBias 2 self.opaque YES return self (void)drawRect (CGRect)r empty (void)drawLayer (CALayer )layer inContext (CGContextRef)context here i am drawing grid filling rect lines string etc..


Corona SDK Animation takes a long time to play after "prepare" step First off, I'm using the current publicly available build, version 2011.704 I'm building a platformer, and have a character that runs along and jumps when the screen is tapped. While jumping, the animation code has him assume a svelte jumping pose, and upon the detection of a collision with the ground, he returns to running. All of this happens. The problem is that there is this strange gap of time, about 1 2 a second by the feel of it, where my character sits on the first frame of the run animation after landing, before it actually starts playing. This leads me to believe that the problem is somewhere between the "prepare" step of loading up a sprite set's animation sequence and the "play" step. Thanks in advance for any help ). My code for when my character lands is as follows local function collisionHandler ( event ) if (event.object1.myName "character") and (event.object2.type "terrain") then inAir false characterInstance prepare( "run" ) TODO time between prepare and play is curiously long... characterInstance play() end end


Can I do iPhone game dev on iPod touch? I do not want a mobile phone, but are there any issues I'd run into by developing games on an iPod for iPhone?


Graphic Animation tools and workflow for iPhone iOS game development I've got some experience producing Flash games, and for all Flash's faults I find the designer developer workflow pretty decent. I can set up a template FLA with placeholder movieclips and code to that independently of a designer animator doing their thing. When it comes time for integration, I can either compile their animations into my project by using a SWC or by loading SWF's at runtime. I've had a quick look, but I can't see any tools that offer a similar workflow for iOS game development. Could anyone producing iOS games shed any light on how they're handling designer animator developer workflow?


How do you save and load settings for an iOS game? I've read a few beginning iPhone game programming books, and they've helped tremendously in my education and advancement in creating a few simple games, but of all the books I've read, there doesn't seem to be anything about creating a Settings Menu or how to change and save settings within a game. What are some ways that settings can be saved loaded? Where are these settings saved? This may seem like a simple, uninteresting question, but I can't find anywhere that has a good explanation on how to go about creating a settings menu and how the data is saved loaded each time the program ends starts... Mind you I'm not really expecting to have code thrown at me, but an explanation on how the structure works and how to wrap my head around the whole concept (though code is pretty )). Or even some articles that explain the concept that I could read would be very helpful.


Comparison between Cocos2d and Corona I'm having a really hard time deciding which way to go on this. I'm about to start developing a game and I haven't been able to find many good comparisons between these approaches. I don't have many requirements for the game yet, but here is what I do know. needs to work on iPhone I don't have much money ( 400 for Unity for iPhone is probably too much. I can probably afford 99 for Corona.) Graphics will be 2D Physics support is not needed Ability to use particles would be nice Game Center support would be nice (Corona is planning to support it soon) It would be nice to be able to support Android as well if it isn't much effort. I have done my own research, so I know basic things about them. I know Corona uses Lua and Cocos2D uses Objective C. I know that Corona allows deployment to iPhone and Android, but how easy is it? Cocos2D is free, but so many people talk about how easy it is to use Corona, but I don't like being restricted to features Corona supports or the price tag. I feel so torn here.


cocos3d versus Unity for simple IOS 3D games? Wondering if anyone here happens to have experience in doing some simple 3D based games apps for IOS, using cocos3d amp Unity and could give some pointers....questions I have are GENERAL 1) It seems currently cocos3d has the most traction in terms of a free 3D games engine for IOS development? 2) If one wanted to step up from the free IOS games engine, to a commercial one it would seem Unity is a popular choice, however you would then not really be doing apple objective c development, but rather unity development and pushing a button to pop out an IOS deployable artifact correct? FOR MY SPECIFIC REQUIREMENT If I was interested in doing the following develop a relatively simple 3D application for iPhone iPad have a small 'world' such as a room with a few basic items in it (table, cupboard) ability to 'drop' a basket ball in the room and have it bounce around based on a physics engine amp perhaps some user input (not sure what, lets say control wind direction) monitor it and react accordingly e.g. say if it goes into a net which is in the room then add a point to the scoreboard At a high level how would one do this using Unity versus using cocos3d, for example 3) Which would be quicker to develop such a basic iPhone iPad game simulation out of Unity cocos3d? 4) Would 'building your world room' approach be different? Like in Unity would you build tables cupboards within a Unity IDE which would make it very quick, whereas with cocos3d would you have to do this programmatically? 5) Would the programming aspect of letting the ball go and monitoring it be different between the two? Or would you roughly in both cases just be setting up world, release ball in certain position, and then engaging physics engine? 6) Any advice guidance re which tool approach to use? (Unity versus cocos3d) 7) Re using cocos3d for my requirement, what additional tools would you recommend above beyond XCode? (e.g. just perhaps some sort of 3D design tool to help model the room and import save somehow for us in cocos3d) Basically I'm a hobbyist iOS developer who wants to do some 3d, so the concept of using a free open source approach such as cocos3d sounds great as (a) it's free, (b) keep using existing skill set re objective c etc, BUT the biggest unknown to me is whether by chosing cocos3d would I be giving myself say 20 hours of work to develop a 3d app animation that could be developed in 1 hour in one of these commercial product (e.g. Unity)?


Is it true that to test a game on the iPhone or iPad, we either need to pay 99 to join Apple Developer program, or jailbreak the iPad? To test a program for iPhone or iPad, seems like the only way is to join the Apple Developer program and pay 99 per year? Can you also jailbreak the iPhone or iPad and be able to test it?


How to balance audio levels to be loud enough yet safe There are a few sound effects in my game that sound a bit piercing over earbuds but OK when played through the iPhone speaker. Also sound levels seem lower on older hardware. Is there some objective way to be sure my sounds are loud enough yet safe? Notes I made my music with GarageBand for iPad. The output was very hot but not clipped. To preview the sounds on my computer I played them in the iPad simulator and matched the volume coming out of my iPhone. To resolve my volume issues, I reduced the high end in Amadeus Pro using the EQ tool. A couple passes for each of the worst sound clips let me reduce the shrillness without muting the volume too badly. Thanks everyone for your help.


Meshes crashed memory from CharacterCustomization example I am trying the CharacterCustomization example from Unity3D which contains two scenes Dressing room and VirtualWorld, run the VirtualWorld on iPhone, it could run but at last it will crashed, Instruments and profiler, I found the meshes are always increased and run out of memory. Anybody could help? thanks.Environment Unity 3.4.0, Xcode 4.0.2, iOS SDK 4.3


Need ideas on how to give my levels structure I am making an iOS game for a project at school. It is going to be a tiny bit like Fruit Ninja, as in it will have different things on the screen, and when you hit them, they die, and you get points. The trouble is that unlike Fruit Ninja, my game will have different types of sprites, all doing different things (moving different places, doing different things, etc). The one thing that is bad about having all of these sprites that do different things is that it is hard for them to look neat on the screen all together. I was planning on having a couple of different gamemodes Time Trial You have 120 seconds to kill as many sprites as possible. Survival You have three lives, every time you try to hit a sprite and miss, you lose a life. ???? Whatever I think of. I am a rookie to game design in general, and I don't know the best way to make my game look good, and play well. I could have all of these sprites on the screen at the same time, or I could have them come in waves, for example 10 of sprite a come on, and once they are killed, 10 of sprite b come on, etc... Please give me your opinion about which one I should code. If you have any other suggestions for either a third gamemode, or a completely different way to make the levels, feel free to tell me.


How can I make a rectangle to an irregular shape? I used masking for breaking an image into the below pattern. Now that it's broken into different pieces I need to make a rectangle of each piece. I need to drag the broken pieces and adjust to the correct position so I can reconstruct the image. To drag and put at the right position I need to make the pieces rectangles but I am not getting the idea of how to make rectangles out of these irregular shapes. How can I make rectangles for manipulating these pieces? This is a follow up to my previous question.


RTS game engine for iOS iPhone Anyone know any free or non free RTS engine that can be used for iOS game development?


How do you handle iPhone graphics for both high and low DPI settings? How do you guys create your game graphics for iPhone? Considering you need a retina version and a nomal one? Do you create a big version of your image, save HD, then resize to smaller version, and save Normal? Or do you create a vector image with say, fireworks, save HD, then resize, then save Normal?


iPhone OpenGL ES partially texture mapping an object I only have a basic understanding of OpenGL, so I'm probably showing my ignorance here. I'm looking for a great iPhone OpenGL ES example of applying a texture (preferably from a texture atlas, but not really a requirement) to specific parts of some arbitrary object model. I have a game where 3D tiles "flip" to reveal some other texture on the backside of the tile. I created the model in Blender and exported it to an Objective C header. The tile isn't a simple "cube", but it is relatively cube shaped. Everything works great when I use a single texture that simply wraps the entire model. But I'm struggling to figure out how I can restrict that texture to just specific parts of the model. To complicate things even more, I ultimately want to texture it with three different images. The top will have "image x", the sides of the tile will have "image y", and the back will have "image z". Thanks!


Ipad actionsheet not showing all buttons in landscape mode when keyboard is present I am developing an Ipad application. It supports both landscape and portrait mode. The app has keyboard.It also shows an action sheet with 4 buttons when required. In portrait mode it works perfectly. But in landscape mode action sheet only show 2 buttons when keyboard is there .Without keyboard it show all 4 buttons. Any solution?


Why are the app analytics for iTunes Connect so wrong? I've developed a mobile game and have it listed both at Google Play and the Apple App Store. The install stats from Google Play are very close to my own stats, but the stats iTunes Connect shows are WAY off it shows nearly 1,000 "app units" (which I assume means installs) when there's only about 120. Most of their "installs" come from China. I'm trying to figure out 1) why iTunes Connect is counting all of these bogus "installs" and 2) what possible benefit someone could have from performing all of these fake installs. Thanks in advance for your insight.


What are the restrictions of 3g online games I am looking into make a 3g online multiplayer game for the iphone. Multiplayer is my main focus but I have noticed all game apps require wi fi. Dose anyone know if this is simply an issue with the speed of the 3g network or dose apple put restrictions on their 3g network that prevents developers from doing this?


shake Vibrate a body in box2d? How do you vibrate or cause a shake effect to a body of type static or dynamic or kinematic. I tried applying forces to a dynamic body in the timeStep, which did not work, as well I tried ApplyLinearImpulse many times a sec within the timeStep, which again did not give me the result. So right now Iam experimenting with adding a static circle body as a hinge point to my rectangular body and create a revolute joint between them. May be then applying a force could result in Tension between the 2 bodies? Does anybody know about this? have any ideas please let me know?


How to create art assets for a 3d avatar editor I am currently prototyping an idea for an iPhone game. I'd like to create an avatar editor inside the game so that the player can create a 3d avatar face and modify certain features (using slider controls), such as nose shape, eye color, mouth size, etc. This has been done in several games, but what I'm looking to do would be fairly cartoon ish caricature ish, similar to the Mii editor on the Nintendo Wii (http www.myavatareditor.com ). I'd also like the final result to have the ability to use some canned animations, such as simple speech animations, smiling, frowning, etc. I am not an artist, so I would be unable to create these assets, but what kind of effort is required for an artist to create the 3d models necessary for this type of game? Also what mechanism would be required to tweak the face's characteristics? Would you use bones or morph targets? How would the final result be animated? Would facial animation use bones or morph targets? I've seen several tools that do this sort of thing too, such as FacialStudio. Are there any facial generation tools out there you'd recommend for generating some base content for this game, or should I just hire an artist to do this type of work. Thanks!


How to protect Lua scripts in IOS game? I'm developing an iOS game and was considering putting level info and monster info in a Lua script for ease of use. However, since I'm using Game Center for multiplayer I'm concerned users will attempt to change these scripts to cheat. What measures can I take to protect my Lua scripts?


Set texture of a LHSprite that is loaded from LevelHelper How do i set the image texture of an LHSprite that is loaded into xCode using levelHelper amp spriteHelper? I am using sprite sheets. So i tried to load the image the old fashioned way using CCSpriteFrameCache, but unfortunately it isnt recognizing the .pshs file ( Any Help would be great!


Which iPhone iPod Hardware to Support for iPhone Game I'm coming from a background of Android. I would like to figure out what kind of iBlah device hardware I need to support for iPhone game development something like Android's OS distribution stats, but for iBlah hardware. From my research, it seems that I need to support both iPod and iPhone. But which versions of hardware? is 3G still used? What about 3GS? For example, the S phones seem to have dual core instead of single core CPUs. I also worry about performance. In Android, I had a severely low end phone, which meant pretty much anything that ran okay there ran okay on other phones. For iPhone, how do I figure out what to support in terms of performance?


Game Development Resources? I want to make an iPhone game and I was wondering if somebody could point me to some resources. Before you rage and close this, I am not looking for just a tutorial on programming, I could just google that. I need to find a tutorial on how to actually make a game, as in how to organize your code, what type of methods to run in separate threads, how to manage these threads in a game, etc. I already know everything I need I can write a physics engine from scratch, I can write a 3D graphics pipeline from scratch, and so on. What I cannot figure out is how to combine all of this knowledge into correctly and efficiently making a game. Obviously for this one would probably go to college, but seeing as I am still in high school, that is not an option. If anyone would know some tutorials or resources, any pointers would be appreciated.


How can I implement temporary effects in Objective C? How could I use this IBAction (IBAction)shield (id)sender appDelegate.healthInt 150 and simply make it work for a limited time. I want to set appDelegate.healthint 150 for about 20 seconds. I'd assume this works with some sort of NSTimer. Not really sure. I'm not using any frameworks.


Changing location after CommitAnimations I'm using the following code to move a UIImageView shootImg.image UIImage imageNamed "Projectile Left 1.png" UIView beginAnimations nil context nil shootImg.center CGPointMake(shootImg.center.x 1000, shootImg.center.y) UIView commitAnimations This works but what I want to do is after UIView CommitAnimations I want to set the location of shootImg using CGPointMake. If I just put it after commitAnimations then the animation doesn't fully complete. Any suggestions? I'm not using any frameworks like cocos2d and if you need to see any more code just ask.


Updating games for iOS 6 and new iPhone iPod Touch Say I have a game that runs full screen on iPhone 4S and older devices. The balance of the game is just right for the 480 x 320 screen and associated aspect ratio. Now I want to update my game to run full screen on the new iPhone iPod Touch where the aspect ratio of the screen is different. It seems like this can be challenging for some games in terms of maintaining the "balance". For example if the extra screen space was just tacked onto the right side of Jet Pack Joyride the balance would be thrown off since the user now has more time to see and react to obstacles. Also it could be challenging in terms of code maintenance. Perhaps Jet Pack Joyride would slightly increase the speed of approaching obstacles when the game is played on newer devices. However this quickly becomes messy when extra conditional statements are added all over the code. One solution is to have some parameters that are set in once place at start up depending on the device type. What are some strategies for updating iOS games to run on the new iPhone and iPod Touch? Edit more info I wonder what happens with a game like Plants vs Zombies? There's quite a bit of artwork that's probably sized to the 320x480 screen. Perhaps the lawn background's width can be increased while the size of the zombies and the row heights stay the same.


Is it true that to test a game on the iPhone or iPad, we either need to pay 99 to join Apple Developer program, or jailbreak the iPad? To test a program for iPhone or iPad, seems like the only way is to join the Apple Developer program and pay 99 per year? Can you also jailbreak the iPhone or iPad and be able to test it?


What platform is best for Android and iPhone development? I've been developing non mobile apps for linux mainly stuff like interpreters, compilers, database engines and business apps. I've been told that if I wanted to learn how to develop iPhone iPad applications, I should buy a Mac since Apple has all it's development tools for iPhone iPad on Mac. Now, what about Android phones tablets? Are the development tools better on Mac or PC? I need to buy a new laptop, and I would like to factor in mobile development in my choice of PC or Mac.


Constant rotation of a revolute joint in box2d I would like to have a line with one end attached to a location and have it rotate constantly (with the same speed) with a maximum of 45 to 45 degrees (i.e. I would like to have it swing like a rope back and forth 90 degrees). Is this possible or should I use non box2d objects to do this (cheat box2d engine)?


How make a laser path prediction line like a slingshot cowboy game? How so I make a laser path prediction line like a slingshot cowboy game in cocos2d or box2d and select the target like "slingshot cowboy" game.


what are the networking features available in iphone? So far I couldn't find anything on google so I'm asking here I need to connect two iphones or more to each other for a multiplayer game, what features does iphone api provide? is there some kind of bluetooth device or equivalent in iphone or should i just search over the wireless network connection? and what api should I use to connect them? is it possible to use c or are the api functions only available via obj c iphone sdk?


Getting started with Box2D for iOS I just want to run any Box2D "Hello World" or test apps. I've downloaded the source twice (zip file the first time and via svn the second time), followed the build instructions (do stuff w cmake, "make", "make install" etc) and don't know where to go from there. How do I run the test apps or Hello World apps that come w Box2D on my iPhone (or simulator)?


How do I consolidate the differences between iOS and Android update loops? I'm currently working on moving some Android ndk code to the iPhone. From looking at some samples it seems that the main loop is handled for you and all you've got to do is override the render method on the view to handle the rendering. Then add a selector to handle the update methods. The render method itself looks like it's attached to the windows refresh. But in android I've got my own game loop that controls the rendering and updates using C time.h. Is it possible to implement the same here bypassing Apple's loop? I'd really like the keep the structures of the code similar.


How to load a text file from a server into iPhone game with AS3 in Adobe AIR? Im creating an iPhone game with Adobe AIR, and I want to be able to load a simple text msg into an dynamic text box on the games front screen from my server (and then be able to update that text file on the server, so it updates automatically in the game after the game is on the app store) How would I go about acheiving that? is it as simple as using a getURL? are there any specifical issues with trying to do this on the iPhone via AIR that I should be aware of? Thanks for any advice.


As an Android dev, what should I keep in mind for porting to iPhone? As an Android game developer, what should I keep in mind while developing my game if I ever wanted to cross platform the game to the iPhone? Any strategies, tips, etc. on porting to both of these mobile platforms?


semi 3d walls, should I use sprite sheet or render them 3d? I'm going to develop a game and this is just a prototype of it's graphics. Knowing that my primary target platform is iPhone, I'm wondering if it's better to create a spritesheet containing all possible angles from a wall or is it better to render them with 3d boxes? here is sample spritesheet I was going to use


Has anyone used PhoneGap to make 2D games for the iPhone? I love simple casual games. I've been riding the bus a lot recently and so simple, no brainer games are great fun and well worth the small price I pay on the App Store. It got me thinking... I know HTML5, CSS3 and JS very well. I looked into PhoneGap and it looks like it's something I could use for making apps for the iPhone. The games I've been fleshing out myself are very simple 2D affairs. Fun, simple and high quality. That's what I'm after with my games... I also make music and my friend is an digital illustrator so together we have all the media covered. Does any one make 2D games for the iPhone using PhoneGap? I'm presuming that because I want to code in JS and use the HTML5 Canvas tag, that PhoneGap does nothing more than provide me a wrapper with a WebKit view? I know it won't be as fast as using native... But is using PhoneGap a viable option?


Make a layer over an image and adjust its co ordinates by touch I need to make a layer over an image and adjust the layer to fit to image and get its co ordinates of the layer. I need to adjust the layer by touch and pinch. The sample image is as below. I need to do this in ios, and can I get any ideas to do this?


Creating an alphabet with numbers in 3d using opengl es How should I create an alphabet with numbers in 3d in opengl es? I'm trying to create them with the existing primitives, but it's not looking good. Do we have any alternate way to get these things done? If so, please let me know! Thanks in advance.


Recommended hardware for developing ios games? I know you have to have mac os x to use xcode and thus to develop compile apps for the iphone. And I'm not exactly wanting to go the hackintosh way, so I'm looking at buying a used mac. What specs are recommended. If I buy a cheap mac mini that has only 1gb of ram would that be enough? (I'm not talking about using that to create the graphics audio, I'll use my normal windows ubuntu pc for that). I'm just talking about being able to use xcode and write applications. I'm trying to spend the least amount I can without running into problems developing the app.


0.99 or Free with Virtual goods Revenue Model for mobile games I'm trying to decide between a paid game and a free to play game. Is there research on the pros and cons of each one. I would really appreciate some concrete data on this and not just opinions. This is for mobile (currently iOS with Android later) game.


shake Vibrate a body in box2d? How do you vibrate or cause a shake effect to a body of type static or dynamic or kinematic. I tried applying forces to a dynamic body in the timeStep, which did not work, as well I tried ApplyLinearImpulse many times a sec within the timeStep, which again did not give me the result. So right now Iam experimenting with adding a static circle body as a hinge point to my rectangular body and create a revolute joint between them. May be then applying a force could result in Tension between the 2 bodies? Does anybody know about this? have any ideas please let me know?


Cocos2d Using single timer scheduler for multiple sprites want to know if is it possible to use single timer or scheduler method for multiple sprites ? Like I am now working on a game and there could be any number of sprites and i want to perform some actions on all of that sprites, So do I have to use as many timers or schedulers as sprites ? Or How can the job be done using only a single timer or scheduler ? What is I schedule a method and use it for, Say 10 sprites ? Will it affect the performance..?


Can I do iPhone game dev on iPod touch? I do not want a mobile phone, but are there any issues I'd run into by developing games on an iPod for iPhone?


8 bit Game To pre scale images, or post scale my Cocos2d scene. Which is the better approach? I'm wanting to develop a game with an 8 bit feel. Since this game is mostly for my personal enjoyment, I've set a requirement that I want my game to have an 8 Bit feel to it that is most similar the 8 Bit systems of yore, on a lovely CRT TV. This is also my first Cocos2d project so I don't know which approach is better. I'd like the general advice of the community on how to render my game. I've come up with two possible approaches. Please advice which is better. Approach 1 Create images for backgrounds and sprites using the "8 bit" resolution of my game. After I'm done making an image, I scale it up and I save two variants the standard sized one and the " 2x" variant. When I render the game, everything looks very 8 Bit but I will still need to apply mathematics to every animation so that my virtual pixels always shift by 4 or 8 pixels (for retina displays) on the screen when they move. This approach doesn't sound difficult but it seems like it could become a bit annoying and tedious. Approach 2 Generate all content in my image designer at the exact resolution of my virtual screen. When I generate my scenes in Cocos2d, I generate them all with the "virtual resolution". When the scene is displayed on the iOS screen, I scale the entire scene up to the resolution of the device. I think this could be the simplest approach since all of my sprite and background movement mathematics can just behave as normal. However, I'm not sure that this approach is even possible. Furthermore, I know that within iOS, graphic scaling has an anti alias affect that gets applied to graphical objects as they scale up. Obviously, I'd want to cut this affect off and just use a "nearest neighbor" algorithm to scale up my scene. If I can't cut off the scaling anti aliasing, I don't want to use this method. However, if I can setup such a rendering system, I think this approach would be best. So, my question is simple. Can I use approach 2 and, if so, which approach is really easier to work with in Cocos2d and iOS?


iPhone point and click adventure game port structure I am porting an AGS game to iPhone, and was wondering what the best approach to the port would be? How best would you structure your code and assets? More specifically, how would you deal with say 100 scenes. My initial approach is to create a scene superclass with things common between all scenes, like backgrounds, music, doors, windows, characters. Then for each scene an inherited version of that superclass with more particular things like checks, dependencies etc. Upon entering the scene, you'd check for dependencies and go from there. This is all off the top of my head mind you, so probably forgetting quite a bit.


How can I make iPhone apps (games) on Windows? I want to start making iPhone games, but sadly I'm a Windows geek.. Is there a way to make good profesional iPhone games without Xcode owning a Mac computer? If not, what do you recommend, a Mac Mini? Thanks in advance!


Accelerometer to move player left and right Please take a look on my code and help me to find problem. I used this tutorial COCOS2D ACCELEROMETER MOVEMENT This works only sometime .some time not move..How can I resolve this problem? Here is my sample DOWNLOAD Thanks for reading this what's wrong with my code ? Is there any other way? Here is my code define kHeroMovementAction 1 define kPlayerSpeed 500 (void) accelerometer (UIAccelerometer )accelerometer didAccelerate (UIAcceleration )acceleration use the running scene to grab the appropriate game layer by it's tag grab the player sprite from that layer using it's tag CCSprite playerSprite mPlayer float destX, destY BOOL shouldMove NO float currentX playerSprite.position.x float currentY playerSprite.position.y if(acceleration.x gt 0.25) tilting the device upwards destX currentX (acceleration.y kPlayerSpeed) destY currentY (acceleration.x kPlayerSpeed) shouldMove YES else if (acceleration.x lt 0.25) tilting the device downwards destX currentX (acceleration.y kPlayerSpeed) destY currentY (acceleration.x kPlayerSpeed) shouldMove YES else if(acceleration.y lt 0.25) tilting the device to the right destX currentX (acceleration.y kPlayerSpeed) destY currentY (acceleration.x kPlayerSpeed) shouldMove YES else if (acceleration.y gt 0.25) tilting the device to the left destX currentX (acceleration.y kPlayerSpeed) destY currentY (acceleration.x kPlayerSpeed) shouldMove YES else destX currentX destY currentY if(shouldMove) CGSize wins CCDirector sharedDirector winSize ensure we aren't moving out of bounds if(destX lt 30 destX gt wins.width 30 destY lt 30 destY gt wins.height 100) do nothing else CCAction action CCMoveTo actionWithDuration 0.5f position CGPointMake(destX, playerSprite.position.y) playerSprite stopActionByTag kHeroMovementAction action setTag kHeroMovementAction playerSprite runAction action else should stop playerSprite stopActionByTag kHeroMovementAction


How to allow character to keep moving after it hits a wall I am developing an iPhone game. There is a fountain that the user should not be able to walk through. Now, this question is about checking circle point collision or anything like that. I am checking collision with CGRectIntersectsRect(character1.frame, fountain.frame). But, here is the problem If I prevent the person from moving he will never be able to move. So, I tried combatting this with following if (character.center.y gt fountain.center.y amp amp CGRectIntersectsRect(character1.frame, fountain.frame) amp amp g false) g true character1.center CGPointMake(character1.center.x, character1.center.y 0.1) if (character.center.x gt fountain.center.x amp amp CGRectIntersectsRect(character1.frame, fountain.frame)) character1.center CGPointMake(character1.center.x 0.1, character1.center.y) if (character.center.y lt fountain.center.y amp amp CGRectIntersectsRect(character1.frame, fountain.frame)) character1.center CGPointMake(character1.center.x, character1.center.y 0.1) if (character.center.x lt fountain.center.x amp amp CGRectIntersectsRect(character1.frame, fountain.frame)) character1.center CGPointMake(character1.center.x 0.1, character1.center.y) This should check what side the character1 is intersecting the fountain and then make it so it is not intersecting the fountain by incrementing or decrementing the x or y coordinates of the characters it. But, this still gives weird results. It will move it diagonally across the fountain if keep holding down on the the top side of the fountain and also, it will keep moving it left other wise on the top of the fountain.


What technologies are used to develop games for tablets and iPhones? What technologies are used to develop games for tablets and iPhones? Would Flash be commonly used? Is HTML5 capable of animation and interactivity, or would a game file simply be placed within HTML5 code? Is Flash and HTML5, and then wrapping the game for different phone tablet operating systems a common combination?


Which API for cross platform mobile audio? This question focuses on the API's available on phones. I'd been planning to use OpenAL in my game for maximum portability. It runs great on Linux so I can quickly iterate while developing as well as leverage the desktop's superior debugging tools. However I've recently heard that Android doesn't support OpenAL well. Instead they've gone with an OpenSL ES library. What I'm looking for is a free Audio library that I can use with minimal custom code on iPhone, Android, and my Linux desktop. Does such a library exists? Some extra details The game is written in C with custom minimal front ends, e.g. ObjC for iPhone, Java for Android, and SFML for desktops. I'm using OpenGL ES for portability as iPhone doesn't support the more advanced OpenGL APIs.


Is good practice to optimize FPS even when it's above the lower limit to give illusion of movement? I started over 50 FPS on the iPhone, but now I'm bellow 30 PFS, I've seen most iPhone games clamped to either 60 or 30 FPS, even when 24 or less would give the illusion of movement. I've concidered my limit to be a little bit over 15 FPS, in fact my physics simulation is updated at that rate (15.84 steps s) as that is the lowest that still give fluid movement, a bit lower gives jerky motion. Is there a practical reason why to clamp FPS way above the lower limit? Update The following image could help to clarify I can independently set the physic simulation step, frame rate, and simulation interval update. My concern is why should I clamp any of those to values greater than the minimum? For instance to conserve battery life I could just to choose the lower limits, but it seems that 60 or 30 FPS are the most used values.


i want to move arrow by dragging and than want to toss throw when i give swipe event In My Application I Have One Arrow Image With Fix Center and i Can rotate it by touch move method on same center but i also need to Toss trow the arrow after doing some rotation with dragging or without doing that How Can I Put The Toss Throw Action in MyApplication Thank You Very Much In advance


Best Method to Create Side Scrolling Levels? Cocos2D I am looking to start my first side scroller project using Cocos2D, but I am curious. What is the preferred best method of creating you levels? For large levels I see hand making it very laborious, is there a more visual way of doing so, as punching in coordinates for everything at a guess seems wrong. Which is why Im here to learn from you guys. So any help would be much appreciated, thanks.


my iPhone app skips the splash screen! I have developed an iPhone app. When I have installed it in the device, it worked fine, ie it showed, the logo screen, the title screen and goes to game screen and now I have exited pressing the home button. The problems starts when I relaunch the app, it straightly goes to the game screen, by skipping the splash screens. While I was working on it the app crashed and when I launched again it showed the logo screen and title screen. But when I relaunched it, the splash screens where skipped. Could you tell me the possible errors that might have occurred?


How are you handling scores that can worsen (e.g. Elo rating) in Game Center? Currently, Game Center leaderboard scores can only change one way (e.g. increase). This makes it impossible (I think) to deal with Elo ratings and the like. How are you getting around this in your leaderboards? I have filed a bug report feature request with Apple already FWIW. Are you using a third party leaderboard service? Rolling your own?


How can I make a rectangle to an irregular shape? I used masking for breaking an image into the below pattern. Now that it's broken into different pieces I need to make a rectangle of each piece. I need to drag the broken pieces and adjust to the correct position so I can reconstruct the image. To drag and put at the right position I need to make the pieces rectangles but I am not getting the idea of how to make rectangles out of these irregular shapes. How can I make rectangles for manipulating these pieces? This is a follow up to my previous question.


.NET WCF as backend server for iPhone games I'm planning to develop an iPhone game. Is it possible to use .NET WCF as a backend? The server would be windows 2008 and MS SQL database.


Efficient Bullet Firing Class I've been struggling with this for a while. I have been trying to create a bullet pool class for a game I have made that doesn't cause a significant fps drop. I have tried creating a bullet pool and have also tried dynamically creating and deleting bullets, both of which drop the fps of the game around 10 15. I ran a test a few days ago and just put a return statement in the bullet pool's firebullet function, which represented the logic leading up to this, function calling, etc. This only dropped the fps 2 4. If I can fire bullets without dropping the fps more than another 2 3, I would be satisfied. My bullets are autorelease objects that are a subclass of a ccnode. I create a ccsprite and a box2d b2body for each one. I am working on the ios platform. Any thoughts on how to make this more efficient? Has anyone managed to do something similar to this?


Rotation based on x coordinate and x velocity? (void) accelerometer (UIAccelerometer )accelerometer didAccelerate (UIAcceleration )acceleration float deceleration 0.3f, sensitivity 8.0f, maxVelocity 150 adjust velocity based on current accelerometer acceleration playerVelocity.x playerVelocity.x deceleration acceleration.x sensitivity we must limit the maximum velocity of the player sprite, in both directions (positive amp negative values) playerVelocity.x fmaxf(fminf(playerVelocity.x, maxVelocity), maxVelocity) Hi, I want to rotate my sprite based on the velocity and accelerometer input. My sprite can move along the X axis like so lt sprite But it always faces forwards, if it is moving left I want it to point slightly to the left, the degree of how far it is pointing to be judged from the velocity. This should also work for the right. I tried using atan but as the y velocity and position is always the same the function returns 0, which doesn't rotate it at all. Any ideas? Regards, Lewis.


What are the app file size limitations for different smartphone OSes carriers? I know the iPhone App Store limits how large an app can be in general and there are also limitations with AT amp T over the size it can be to transmit over a data plan vs WiFi. I have no idea what, if any, these limits are for Android apps and what I'm finding online is a mix of different numbers. Does anyone know these numbers definitively? The Android game I'm porting is in the 20 30MB range and we'd like to know if we need to further reduce its size.


install unity package in to iphone? HI All, what is the steps of to install the unity package in to iphone and create a build (app file )that my client can also able to install in his iphone . Thanks, balraj.


Issues with background coordinate configuration in objective c with runAction? In my game I want to have two backgrounds going one after the other creating a continuous loop moving to the left. However, right now one goes, and the other does not follow it. Here's what I currently have, which isn't working. if((self super init )) self.isTouchEnabled YES background CCSprite spriteWithFile "testbackground88.png" self addChild background z 1 background.position ccp(500,240) id repeat1 CCRepeatForever actionWithAction CCSequence actions CCMoveTo actionWithDuration 7 position ccp( 300,240) , CCPlace actionWithPosition ccp(800,240) ,nil background runAction repeat1 background2 CCSprite spriteWithFile "testbackground92.png" self addChild background2 z 1 background2.position ccp(500,240) id repeat2 CCRepeatForever actionWithAction CCSequence actions CCMoveTo actionWithDuration 7 position ccp( 300,240) , CCPlace actionWithPosition ccp(800,240) ,nil background2 runAction repeat2


Thread safety in Cocos2d iPhone? After tinkering a bit with cocos2d, I discovered that there is no classic game loop and everything is more or less event driven. I guess I can wrap my head around that, no problem. But I cannot find anything about thread safety. Say, I schedule something to occur every two seconds, which Thread will run the code? Given that I cannot find anything about that, I guess there is just one Cocos2d Thread and everything will be fine. Nevertheless, this implicit assumption does not give me a good feeling. Knowing is better than guessing. ) Can anyone shed some light onto that topic?


Has anyone used MonoTouch for a game? With the pending release of MonoDroid we have decided to revisit MonoTouch as a possible alternative to gearing up some Objective C skills. I was wondering if anyone had any experience and would share the gotchas before everyone else hits them. Set to CW, one hurdle per answer please. MonoTouch allows C development of iPhone and iPad applications with access to native code libraries.


Do I have to keep all my UI elements within the safe area defined by the iPhone X? Suppose this is my game's screen for the iPhone 8 I have 7 blue buttons, and one blue bar at the bottom which is used to display commentary text. I understand that the iPhone X has a safe area. In this case, there would be a bottom inset because of the home indicator and the swiping gestures. The swiping and the home indicator pose no issue to my players. The game does not use any sort of gestures, and the center button is large enough that the home indicator doesn't really affect its aesthetics. Given that, do I still have to avoid the bottom inset? Am I supposed to keep all my buttons within the safe area defined by the iPhone X even when it doesn't affect my user experience? If I were to stay within the safe area, then I would have to push the bar and the buttons upwards by several pixels, then the leftmost buttons have to be pushed to the right, and the rightmost buttons to the left. That wouldn't look really great with my game art. Would my game be rejected if I don't keep my elements inside the safe area? It seems like I must indeed keep all my UI elements within that area, based on this image from the keynote


iOS game integrated with Facebook Random game How could I implement a random game for iOS via Facebook. I registered my game with Facebook and done everything so far... Can Facebook do such a thing? EDIT I connected my app to Facebook, I can send requests, publish open graphs etc. But i need to connect players to play online via Facebook, such as Bubble Galaxy with Buddies. Do they use Facebook for this? Any tutorial or idea ?


Slow motion of a spherical object on an blunt slant obstacle In cocos2d environment and box2D when an spherical object falls on a blunt slant obstacle, it moves really slowly, that's nauseating, if you have coded to not to have any interaction with world while object is in motion. Is there any way to get rid of this slow motion of object?


How can I scroll sprites when swiping using Cocos2D? I'm adding 3 sprites (layers) to CCParallaxNode BGLayer CCSprite spriteWithFile "Layer.png" backgroundNode addChild BGLayer z 2 parallaxRatio layer1Speed positionOffset ccp(screenSize.width 2,screenSize.height 2) How can I create the scroll when swiping?


Saving data in games? I'm soon going to make a game for the iPhone as a school project. My idea was to make a TLOZ remake, with Tiled Maps. However, I'm not quite sure how save the data. In TLOZ you have a lot of sub quests, treasures, items, and much more. I want the user to only be able to open a treasure once. Therefore I have to save this information somehow. However, I'm not sure how to assign the data to that certain object, for example that treasure that Link has opened. I thought about making id's for every object, but I'll have multiple maps, and it doesn't seem like the right solution. Are there any standards for this? Or does anyone have another idea?


Game server for an android iOS turn based board game I am currently programming an iPhone game and I would like to create an online multiplayer mode. In the future, this app will be port to Android devices, so I was wondering how to create the game server? First at all, which language should I choose? How to make a server able to communicate both with programs written in objective c and Java? Then, how to effectively do it? Is it good if I open a socket by client (there'll be 2)? What kind of information should I send to the server? to the clients?


my iPhone app skips the splash screen! I have developed an iPhone app. When I have installed it in the device, it worked fine, ie it showed, the logo screen, the title screen and goes to game screen and now I have exited pressing the home button. The problems starts when I relaunch the app, it straightly goes to the game screen, by skipping the splash screens. While I was working on it the app crashed and when I launched again it showed the logo screen and title screen. But when I relaunched it, the splash screens where skipped. Could you tell me the possible errors that might have occurred?


Help figuring out how to build for the iOS Unit3D So currently I'm exporting my game strictly for testing to the iOS (iPad.) I don't own a Mac, so I'm having my client make a build from his Mac, but that means I need very specific instructions for him as he isn't very tech savvy. I've looked online and can't find much at all about what all you need to export from Unity and make a file for the iOS, then sync it to your iPad. Could anyone provide a video or and help at all for this? Thanks, Tim.


Save File sharing over Mobile Networks I'm looking to have people share game content, save files, or characters on a mobile game platform. That means they need to be able to upload and download from their phone, other iOS device, or computer. What's the best way to do this? Does Apple have a history of allowing games to download 'content' (incl. graphics) that hasn't been approved? Are there any apps that do this, that I can try out? Thanks, EDIT The files I want to share will be simple .plist files, probably in binary format.


How do I create this underwater effect with Cocos2D? http vimeo.com 2461697 Hi everyone, I'm trying to create an effect like this, the underwater effect (water distortion). I've looked around and I've seen references to "water caustics" but I'm not sure how to create this in Cocos2d or if it's done with obj c only. Thanks.