yurembo Posted Saturday at 10:07 PM Posted Saturday at 10:07 PM @Josh your code from Top-Down Shooter Example works well: coord.z = self.camera:GetRange().y farpoint = self.camera:ScreenToWorld(coord, framebuffer) but If I create a camera in the editor and assign the camera to a variable in the code, the GetRange and ScreenToWorld functions don't work—the lua interpreter throws an error saying it doesn't recognize such functions. Other functions work fine. Quote
yurembo Posted Saturday at 10:47 PM Author Posted Saturday at 10:47 PM in debug mode: in release mode it's working fine Quote
yurembo Posted Saturday at 10:57 PM Author Posted Saturday at 10:57 PM I think the problem above consists in a work with containers: set and map as told in the message. I created a lot of bullets. Quote
Solution Josh Posted Tuesday at 09:42 PM Solution Posted Tuesday at 09:42 PM The variable you have is probably an Entity object, and you need to cast it to a Camera object: local camera = Camera(self) if camera ~= nil then coord.z = self.camera:GetRange().y farpoint = self.camera:ScreenToWorld(coord, framebuffer) end Quote Let's build cool stuff and have fun.
yurembo Posted 15 hours ago Author Posted 15 hours ago @Josh Yup, this works well! My temporary solution was to create a local camera. You see: a bullets buffer overflow is a second problem. Quote
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.