rolling dice implementation

Member
Posts: 164
Joined: 2010.10
Post: #1
I would like to develop an interface that the 2d click of a button throws of the dice.

a link best of many words:
http://gizmodo.com/5023627/iphone-dice-g...nd-physics

roll the dice on the table and are seen from above the table.
I was wondering how you could implement this or if there is already a code to display this roll of the dice.
I dropped to 3d for such a thing?

some library like havok in iphone?
thanks
Quote this message in a reply
Member
Posts: 27
Joined: 2009.07
Post: #2
For physics, you should look at Chipmunk Physics (http://code.google.com/p/chipmunk-physics/).

As far as resolving the dice roll goes, you really have two options, depending on what you intend for your application:

1) If your application expects the user to be responsible for totaling his/her die roll (meaning this is just a dice utility, not something that performs calculations on the dice, such as one might expect from a tabletop roleplaying utility), then having the dice properly textured and working with the physics should be enough on that end.

2) If you want to do any sort of calculations on the results of the dice, you will have to develop a method of resolving the finalized rotation of a dice after the physics engine has had its go and the object has settled, and determine what the displayed value is from there.

As far as shaking the device for rolling, you'll want to look at the accelerometer input methods, and move on from there by detecting shake gestures.

Goodbye.
Quote this message in a reply
Member
Posts: 164
Joined: 2010.10
Post: #3
thanks for hints, it, seems that Chipmunk Physics is a 2d physic engine...could be enough?
i have found http://bulletphysics.com/Bullet/BulletFull/ for 3d
i try to study something, i have never used a physic library
any tuts?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #4
Chipmunk is 2D only yes. Probably not what you want.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 27
Joined: 2009.07
Post: #5
Whoops, not sure why I pointed you to Chipmunk. <________< Sorry about that - yeah, look at Bullet, that seems to be one of the more popular ones targeting iOS.

Personally, C++ is one of the things that I refuse to let Mac people take away from me, and I'm in love with the PhysX SDK, so I'm probably not the *best* source of physics questions for Apple platforms.

Goodbye.
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #6
(Nov 11, 2010 09:35 AM)Minalien Wrote:  Personally, C++ is one of the things that I refuse to let Mac people take away from me,

It's not that great.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  what's the best way to create rolling terrain with Cocos2D? aerospaceman 3 6,250 May 24, 2011 02:15 PM
Last Post: Skorche
  Rolling My Own POD Exporter earamsey 2 3,115 May 24, 2009 06:39 AM
Last Post: earamsey
  Audio implementation / format? zircon 10 6,614 Jul 8, 2008 03:50 PM
Last Post: AnotherJake