FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Bouncing ball physics

2 posters

Go down

Bouncing ball physics Empty Bouncing ball physics

Post  matthew 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

Back to top Go down

Bouncing ball physics Empty Re: Bouncing ball physics

Post  sw 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.
sw
sw

Posts : 73
Join date : 2008-10-12

Back to top Go down

Bouncing ball physics Empty Bouncing Physics

Post  matthew 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

Back to top Go down

Bouncing ball physics Empty Bouncing Physics Reply

Post  matthew 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

Back to top Go down

Bouncing ball physics Empty Re: Bouncing ball physics

Post  sw 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);
sw
sw

Posts : 73
Join date : 2008-10-12

Back to top Go down

Bouncing ball physics Empty Re: Bouncing ball physics

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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