Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / b2_velocitythreshold access

Author
Message
The Daddy
15
Years of Service
User Offline
Joined: 13th Jan 2009
Location: Essex
Posted: 28th May 2012 21:46
I have been reading around as I am trying, as a learning exercise, to write a brick breaker game. I am having problems with the ball. I have set friction to zero, gravity to zero but apparently with box 2d each impact absorbs some of the energy of my ball, hence gets slower and slower.

I have read that if the b2_velocitythreshold (a constant) needs to be set to zero and then box 2d recompiled.

As I am using tier one this is not possible. Any ideas how to resolve this in tier one.


Thanks

Constantly seeking!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 28th May 2012 22:14
You might want to a combination of the SetSpritePhysicsDamping and SetSpritePhysicsRestitution commands.

The first lets you set it so that you don't lose speed due to wind resistance and the lets set how much energy is lost due to collisions.

Setting the first to zero (no friction) and the second to 1 will keep your ball running smooth.

Cheers,
Ancient Lady

Login to post a reply

Server time is: 2024-11-23 14:35:43
Your offset time is: 2024-11-23 14:35:43