# Question for the Gurus

This topic is 5135 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hey. im trying to make a star fox clone.. how best should i approach this.. i was thinking of the following. (kind of a 3d version of the snes classic, not so much the great leap to starfox64, which is beyond my abilities at present) a) create a large quad grid, with a texture of grass for the ground (for starters). b) place a .X model as the ship. c) render some cuboid's as bulding within the world. d) then the ship would move at constant speed forward.. My main questions are the following: I can do step a+b+c but when I move the ship forward I find that either I get no movement, or possibly a flick\jerk. Or if I tweak with the code it looks like the grass plane and ship are moving foward and view(camera) is stationary.. This stems I think from a problem with the view and world matrix. I dont quite understand these in full, so most likely the prob. I thought I could just move the ship every frame along with the eye also. But this leads to the stationary effect correct? In star fox the camera works in the effect that it looks as tho the ground is streaming foward.. I was wondering can i create this effect by actually traveling this distance. Also am I correct in assuming by playing around with the far clip I can create the effect of new objects coming into view. like in star fox? this would be invisible until z=500 ex.. cuboid at 100,100,1000 if the far clip was only 500 Anyway please help.. i can also email my code if you can lend a hand, coz i dont think snippets will help..as i prob have a couple of errors.

##### Share on other sites
Keep your terrain/level at (0|0|0) in world space, and just move your ship in world space [D3DXMatrixTranslate and SetTransform(D3DTS_WORLD, &matShip)]. Then, place your view matrix [SetTransform(D3DTS_VIEW, &matView)] slightly behind the position of the ship. You'll need the inversed world matrix of the spaceship.

You might also use fog placed slightly in front of your far clip plane (e.g. z=500 then fog at z=475) so the objects that move into your view won't pop up abrubt. But there might be also better solutions on today's hardware.

regards

##### Share on other sites
cheers foxhunter.
ill give these ago. yeah the inverse might be my problem, i wasent doing that.

one other question though.
i custom draw using the vertex buffer.. how can i keep the world view 0,0,0 my world is presently defined like this..

Vertex g_floorVertices[] =
{
// x y z tu tv
{ -5000.0f, 0.0f,-5000.0f, 0.0f, 0.0f,},
{ -5000.0f, 0.0f, 5000.0f, 0.0f, 1000.0f,},
{ 5000.0f, 0.0f,-5000.0f, 1000.0f, 0.0f,},
{ 5000.0f, 0.0f, 5000.0f, 1000.0f, 1000.0f,},
};

and drawn like so

g_pd3dDevice->SetTexture( 0, g_pTexture );

g_pd3dDevice->SetStreamSource( 0, g_pVertexBuffer, 0, sizeof(Vertex) );
g_pd3dDevice->SetFVF( Vertex::FVF_Flags );
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2);

##### Share on other sites
// set our world matrix to identity (0|0|0)
D3DXMatrixIdentity(&matTerrain);
g_pd3dDevice->SetTransform(D3DTS_WORLD, &matTerrain);

// draw the terrain
g_pd3dDevice->SetTexture( 0, g_pTexture );
g_pd3dDevice->SetStreamSource( 0, g_pVertexBuffer, 0, sizeof(Vertex) );
g_pd3dDevice->SetFVF( Vertex::FVF_Flags );
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2);

// set our world matrix to the world position of the ship
g_pd3dDevice->SetTransform(D3DTS_WORLD, &matShip);

DrawYourShip()

##### Share on other sites
In the Starfox games, the camera follows your ship with a slight delay. You could use simple spring dynamics to implement this yourself - just tie the other end of "spring" to little above the ship, and the other end of the "spring" (and your eyepoint) a couple of meters backwards from the first end.

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5
JoeJ
13

• 14
• 10
• 24
• 9
• 57
• ### Forum Statistics

• Total Topics
632640
• Total Posts
3007616
• ### Who's Online (See full list)

There are no registered users currently online

×