Jump to content

camera->unproject()


xtreampb
 Share

Recommended Posts

So i'm trying to throw a stone when i press the mouse. in my app::loop function i have this code

if(window->MouseHit(1))
{
Model *tStone=Model::Load("Models/Stone/Stone_1.mdl");
tStone->SetShape(Shape::Load("Models/Stone/Stone_1.phy"));
tStone->SetMass(1);
Vec3 mouseposition = window->GetMousePosition();
//mouseposition.z-=5;
mouseposition=camera->UnProject(mouseposition);
tStone->SetPosition(mouseposition);
tStone->SetVelocity(Vec3(0,0,10));
}

 

i'm using this as my reference. When i press my left mouse button, a stone is indeed "thrown" however when i move my mouse to a different location, the stone is still thrown in the same location, it didn't move to fallow my mouse from what i can tell. Am i doing this wrong, or should i report this as a bug?

 

~Xtreampb~

bool Life()
{
 while(death=false)
 {
   if(death==true)
   return death;
 }
}

 

I have found the secret to infinite life

 

Did I help you out? Like my post!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...