iPhone - Getting Started

simonh
Posts: 2
Joined: Tue Dec 02, 2008 11:15 pm

iPhone - Getting Started

Post by simonh »

I've had a day of much frustration trying to get Bullet integrated with my 3D iPhone project.

At the moment I'm just trying to get a simple example going.

I've followed all the installation instructions, and believe everything is set-up OK. Indeed, the following code compiles OK (taken from an Hello World example):

Code: Select all

	#include "btBulletDynamicsCommon.h"

	///collision configuration contains default setup for memory, collision setup. Advanced users can create their own configuration.
	btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();

	///use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
	btCollisionDispatcher* dispatcher = new	btCollisionDispatcher(collisionConfiguration);

	///the maximum size of the collision world. Make sure objects stay within these boundaries
	///Don't make the world AABB size too large, it will harm simulation quality and performance
	btVector3 worldAabbMin(-10000,-10000,-10000);
	btVector3 worldAabbMax(10000,10000,10000);
	int	maxProxies = 1024;
	btAxisSweep3* overlappingPairCache = new btAxisSweep3(worldAabbMin,worldAabbMax,maxProxies);

	///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
	btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver;

	btDiscreteDynamicsWorld* dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,overlappingPairCache,solver,collisionConfiguration);
However, the trouble starts after this. The next line is this:

Code: Select all

dynamicsWorld->setGravity(btVector3(0,-10,0));
Which gives me this error:
/Users/si/Desktop/b3d/Classes/AppDelegate.mm:40: error: expected constructor, destructor, or type conversion before '->' token
I then get 5-6 similar errors further down.

I can't fathom why I'm getting these errors. It looks as if should work. I've set up the header paths, I'm linking with the relevent .a libs, and the source code looks fine.

The example project works OK.

I'm using Xcode 3.12, and the iPhone SDK 2.2.

Any help much, much appreciated.
simonh
Posts: 2
Joined: Tue Dec 02, 2008 11:15 pm

Re: iPhone - Getting Started

Post by simonh »

It's OK - I fixed the problem by moving the code somewhere else.
sheffdog
Posts: 1
Joined: Sat Jan 10, 2009 9:55 pm

Re: iPhone - Getting Started

Post by sheffdog »

would you care to elaborate I'm having the exact same problem with getting bullet working on the iphone as well.

Thanks,
/\/\ason
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: iPhone - Getting Started

Post by sparkprime »

looks like a compiler bug, it's only defined on the line above