SpiderPig Posted April 25, 2024 Posted April 25, 2024 This may be silly but I'm constantly forgetting which function does what when it comes to the camera functions Project() & UnProject(). It might be helpful if the first argument of both commands were renamed to "Vec3 &screen_position" & "Vec3 &world_position" respectively. That way it be easy to identify what does what! Quote
SpiderPig Posted April 25, 2024 Author Posted April 25, 2024 Also screen_position should probably be an iVec3 like is returned by window->GetMousePosition(), unless there's a need for it to be Vec3? Quote
Josh Posted April 25, 2024 Posted April 25, 2024 Yes, I always forget which is which. Maybe these should be ScreenToWorld and WorldToScreen? 1 Quote Let's build cool stuff and have fun.
Josh Posted April 25, 2024 Posted April 25, 2024 10 hours ago, SpiderPig said: Also screen_position should probably be an iVec3 like is returned by window->GetMousePosition(), unless there's a need for it to be Vec3? z coordinate is the distance in front of the camera. 1 Quote Let's build cool stuff and have fun.
SpiderPig Posted April 25, 2024 Author Posted April 25, 2024 6 hours ago, Josh said: Yes, I always forget which is which. Maybe these should be ScreenToWorld and WorldToScreen? Yeah, in one of my projects I made a wrapper for them. I called them CastToScreen and CastToWorld. Naming them to show what they do will help. Quote
SpiderPig Posted April 25, 2024 Author Posted April 25, 2024 6 hours ago, Josh said: z coordinate is the distance in front of the camera Ah so it needs to be a float then. 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.