Shard Posted July 31, 2010 Share Posted July 31, 2010 I'm trying to find the object that the camera is looking at and then set another object at that position. I figured I'd do this by doing a pick to see what is being looked at and then set the object there. Unfortunately, the code below didn't work because it places the object (the gun body) at the points along which the pick function is run, so the body moves back and forth in a line. Pick pick; if(EntityPick(&pick,*camera,1000)) gun.body.SetPosition(pick.GetPosition()); And changing it to Pick pick; if(EntityPick(&pick,*camera,1000)) gun.body.SetPosition(EntityPosition(pick.entity); Didn't move the body at all. Any thoughts? Quote Programmer/Engineer/Student www.reikumar.com 2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM C++ - Visual Studio Express - Dark GDK - Leadwerks SDK Link to comment Share on other sites More sharing options...
Canardia Posted July 31, 2010 Share Posted July 31, 2010 You need to hide the gun before the pick and then show it again after it. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Shard Posted July 31, 2010 Author Share Posted July 31, 2010 You need to hide the gun before the pick and then show it again after it. Thanks that worked. However the results aren't quite what I want them to be. Is there another way that I can set the gun to be a constant distance away from the camera (at the center of the screen)? Quote Programmer/Engineer/Student www.reikumar.com 2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM C++ - Visual Studio Express - Dark GDK - Leadwerks SDK Link to comment Share on other sites More sharing options...
cocopino Posted July 31, 2010 Share Posted July 31, 2010 Is there another way that I can set the gun to be a constant distance away from the camera (at the center of the screen)? When the gun is positioned correctly, parent it to the camera. Quote desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32 Link to comment Share on other sites More sharing options...
Recommended Posts
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.