Archived

This topic is now archived and is closed to further replies.

Woody FX

A Bouncing Ball

Recommended Posts

Woody FX    169
Now that i have drawn a room i want the ball to bounce about. The Velocity will never change Just the direction as it boucnces off walls! I am using D3D so will it scale the ball for me? What is the best wat to draw a simple white ball? Are there any special functions to handle this in DirectX all ready. Thanks Brian (C++)

Share this post


Link to post
Share on other sites
Pseudo    100
use something like this:

struct Ball
{
Vector3 position, velocity;
};

then each frame you update it''s position by adding its velocity, and reflect the velocity when it hits a wall. Then you can draw a sphere centered at position. Use the D3DX Mesh to load a sphere from an x file (sphere.x comes with the SDK).

Share this post


Link to post
Share on other sites
Woody FX    169
Will DirectX handle the scaling of the sphere as it travels along the Z-axis and is there anything special i need to setup so that it knows how to do this?

I get that i will need a starting Position, Vector and Velocity.
And these will be updated on every loop?

I though this was simple (it probably is ) but could not track down how to do it through my Books and pages printed off the Web last night!

Dont get acess to the Web at home! :-/

Thanks for info Pseduo

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
"Will DirectX handle the scaling of the sphere as it travels along the Z-axis?"

it will if you are using perspective projection matrix.

"And these will be updated on every loop?"

Totaly up to you. Do it in sinc with frames or make separate thread for your "phisycs".

"I though this was simple"

Wrong. It is out right primitive, 30min of work or less.

Share this post


Link to post
Share on other sites
Woody FX    169
Ok so I will look in to perspective projection matrices.
Will update every frame.

Still not simple ...yet!

Is there a specific function that will create a simple sphere?
I created the Cube the ball is to bounce around by just specifying the Vertices in the Code using the a FVF.

Is there a way to do this for a sphere? and how if you know off hand?

Thanks
Brian

Share this post


Link to post
Share on other sites