Archived

This topic is now archived and is closed to further replies.

Probably a very simple problem

This topic is 5981 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, I''m working on a camera and I can''t get this to work:
  
void Init_Camera(CCamera Camera)
{
	CVector PositionVectorTemp =	{ 0.0f, 0.0f, 0.0f };
	CVector UpVectorTemp =			{ 0.0f, 1.0f, 0.0f };
	CVector ViewVectorTemp =		{ 0.0f, 0.0f, 1.0f };

	Camera.PositionVector = PositionVectorTemp;
	Camera.UpVector = UpVectorTemp;
	Camera.ViewVector = ViewVectorTemp;
}
  
getting Camera.PositionVector (or any other one), doesn''t get the data from PositionVectorTemp (or any other). Was wondering why. Thanks, Scott Email Website
"If you try and don''t succeed, destroy all evidence that you tried."

Share this post


Link to post
Share on other sites
nevermind... i solved it.

simply changing

  
void Init_Camera(CCamera Camera)

to

  
void Init_Camera(CCamera &Camera)


did the trick, but I really don''t know why...

Scott

Email
Website

"If you try and don''t succeed, destroy all evidence that you tried."

Share this post


Link to post
Share on other sites
Because your original version is "pass by value", meaning a new camera is copied from your argument and passed to the function. The second version is "pass by reference", where the actual argument is passed into the function. Without using "*" or "&" on your arguments, they are all passed by value.

Share this post


Link to post
Share on other sites