I need to change my object’s position with respect to camera position. I mean, my object should always be just in front of the camera. It should follow camera movements.What do I need to add my object drawing function?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re using old-style fixed function matrices, the easiest way to position an object relative to the camera is to do it after removing the camera matrix from the stack. For example, you might have a matrix setup like this:
Then switch it around into this:
If you’re using shaders, this is even easier. If you have a matrix stack, just do the same stack-based operation as you see here. If you’re doing something else to build your matrices, just don’t factor the camera matrix into the transform.