Shard Posted July 31, 2010 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
Canardia Posted July 31, 2010 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 ■
Shard Posted July 31, 2010 Author 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
cocopino Posted July 31, 2010 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
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.