So I’m making a function that detects collisions between two sprites, and would like to add two buffers as optional parameters to be filled with the angle of the sides of each objects collision.
However this means the two buff parameters must be references, and must be there whenever the function is called, and I am not aware of any way to make a default reference. How can I do this?
Here’s the actual function:
bool CheckCollision(T* obj1, T* obj2, float& CollBuff1= new float, float& CollBuff2= new float);
I tried to make a default with ‘new’ but it didn’t work.
You can overload the function. Just define a second wrapper function like so:
And define a second one for when only one float is provided, if you like.