Probably a very simple problem

Started by
2 comments, last by Nibbles 22 years, 8 months ago
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."
Advertisement
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."
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.
ah, groovy.

Now to figure out this damn gimble lock

Thanks,
Scott

Email
Website

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

This topic is closed to new replies.

Advertisement