Bouncing ball physics

View previous topic View next topic Go down

Bouncing ball physics

Post  matthew on Tue Nov 25, 2008 1:13 pm

Hi All,

I'm trying to figure out how to implement "bouncing" object physics using SIO2. Adding an object moving in the same direction as the camera is relatively easy using the tutorial code.

But how can I make an object bounce? Basically I'm confuses as to make an object move "X" degrees downward in front of the camera (or any other object for that matter).

Can anybody please tell me how I can compute the appropriate linear velocity to do this? I basically need to compute a velocity that points downward in front of an object? Any clues are much appreciated.

Cheers.

matthew

Posts : 64
Join date : 2008-11-12

View user profile

Back to top Go down

Re: Bouncing ball physics

Post  sw on Tue Nov 25, 2008 10:39 pm

setRestitution(1.0f) try it , and please tell me the result.
btw: the bounce effect depends on both of the collision objects.
avatar
sw

Posts : 73
Join date : 2008-10-12

View user profile

Back to top Go down

Bouncing Physics

Post  matthew on Wed Nov 26, 2008 2:17 pm

'Ey Matt,

You to set the restitution to 1.0 what is that? The friction property is relatively obvious.

Basically, what I'm trying to achieve is to apply a bounce to a ping pong ball. Mayby you misunderstood my question.

That's why I'm wondering, how do I control the amount of "downward" swing in the direction of the camera? For example, I want to send an object either 20 or 30 degrees DOWN in the direction of the camera.

Cheers.

matthew

Posts : 64
Join date : 2008-11-12

View user profile

Back to top Go down

Bouncing Physics Reply

Post  matthew on Wed Nov 26, 2008 2:22 pm

Er... I meant to thank "sw" for replying to this question, earlier. Thanks for any help.

Cheers,
Matt

matthew

Posts : 64
Join date : 2008-11-12

View user profile

Back to top Go down

Re: Bouncing ball physics

Post  sw on Wed Nov 26, 2008 10:56 pm

matthew wrote:Er... I meant to thank "sw" for replying to this question, earlier. Thanks for any help.

Cheers,
Matt

btVector3 forward(dest[0]-campos[0],dest[1]-campos[1],dest[2]-campos[2]);
forward.normalize();
/* you should adjust your Speed, gravity , dest . and apply -sinf(30) to Z axis, etc */
forward*=ping_pong_Speed;
yourPing_Pong->getWorldTransform().setOrigin(campos);
yourPing_Pong->setLinearVelocity(forward);
avatar
sw

Posts : 73
Join date : 2008-10-12

View user profile

Back to top Go down

Re: Bouncing ball physics

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum