Hi
Im kinda rusty in DGDK so here we go again..
I have a terrain object which is about 4000 x 4000 in size..
How do I get the 3d position for the mouse then the mouse "hovers" over the object?
here is the code I have soo far, but it dosnt seem to work, cause the object get missplaced WAY OFF!
vector3d pick;
float dist;
int pickobj;
while ( Video->Run() )
{
dbControlCameraUsingArrowKeys( 0 , 1 , 1 );
Video->DrawTextA( 0 , 00 , Str(Mouse->GetPosition().x) );
Video->DrawTextA( 0 , 15 , Str(Mouse->GetPosition().y) );
pickobj = Scene->PickObject( Mouse->GetPosition() );
dist = Scene->GetPickDistance();
Scene->PickScreen( GetVector2d( Mouse->GetPosition().x , Mouse->GetPosition().y ) , dist );
pick = Scene->GetPick();
pick.y = 0.0f;
Video->DrawTextA( 0 , 45 , Str(pick.x) );
Video->DrawTextA( 0 , 60 , Str(pick.y) );
Video->DrawTextA( 0 , 75 , Str(pick.z) );
Video->DrawTextA( 0 , 90 , Str(dist) );
Video->DrawTextA( 0 , 105 , Str(pickobj) );
Sphere->SetPosition( pick );
if( Mouse->GetClicked( MouseRight ) )
{
Ground->SetPosition( GetVector3d( -512 , 0 , -512 ) );
}
if( Mouse->GetHeld( MouseLeft ) )
{
Vertex->LockLimbData( Ground , 0 );
for(int i=0; i < Vertex->GetVertexCount(); i++)
{
vector3d vpos = Vertex->GetVertexPosition( i );
if(dist3d( pick , vpos ) < 100.0f )
{
Vertex->SetVertexPosition( i , GetVector3d( vpos.x , vpos.y + 1 , vpos.z ) );
}
}
Vertex->UnlockData();
}
Mouse->Update();
Video->Sync();
}
btw, im using AndrewT's oop wrapper ObjectGDK - so if u get confused, ask and i will explain
Keep it simple.
Questions? Mail me