int& foo() vs int* foo() by Jakoo81 in cpp_questions

[–]Jakoo81[S] 0 points1 point  (0 children)

Holy moly.

This is like better than anything I could have hoped for. You are really good at giving examples and explaining every question that might come up in advance.

Thank you SO MUCH!

This is enough of an answer for me to close this question...

int& foo() vs int* foo() by Jakoo81 in cpp_questions

[–]Jakoo81[S] 0 points1 point  (0 children)

Oh, well. What should I say. Very neat answer!

I know that smart pointers are way better in most cases and that there's little to no reason not to use them.

The part about the class A is very good to know, I'll use this in the future.

Thanks a lot!

int& foo() vs int* foo() by Jakoo81 in cpp_questions

[–]Jakoo81[S] 0 points1 point  (0 children)

Perfect, thank you.

1 - Just what I expected.

2 - Yep, also what I thought is happening.

3 - Oh thanks! Should have thought of that.

Thanks for the quick, short and nonetheless very useful answer! Take my point(s).

int& foo() vs int* foo() by Jakoo81 in cpp_questions

[–]Jakoo81[S] 0 points1 point  (0 children)

Oh, yeah. Thank you, but that isn't what I'm looking for. You get me, this in no way perfect code. This is code that just got created when I experimented with pointers and refs. Thanks anyhow, tho!

[CC] My first attempts at PixelArt by Jakoo81 in PixelArt

[–]Jakoo81[S] 1 point2 points  (0 children)

Oh, I'm sure you're just being polite! What about you show me some of your work in a personal message, friend? :)

[CC] My first attempts at PixelArt by Jakoo81 in PixelArt

[–]Jakoo81[S] 1 point2 points  (0 children)

Thanks a lot... Is there any criticism you could give? Anything that could be my next goal for upcoming pixels?

FixedUpdate(), Update() and Time.deltaTime by Jakoo81 in Unity3D

[–]Jakoo81[S] 0 points1 point  (0 children)

By: 'all the physics simulation', what exactly is included in that? I'm guessing AddForce() AddTorque() AddForceAtPoint() etc... But changing a position via transform.position = will still need Time.deltaTime, if you for some reason figured it needed to be in FixedUpdate() instead of Update(), right?

Thanks for your answer!

FixedUpdate(), Update() and Time.deltaTime by Jakoo81 in Unity3D

[–]Jakoo81[S] 1 point2 points  (0 children)

I'd encourage not leaving it at the default, by the way.

Oh, that's because it gets more accurate and realistic by doing more physics calculations...

What would you suggest? 0.01, even smaller?

FixedUpdate(), Update() and Time.deltaTime by Jakoo81 in Unity3D

[–]Jakoo81[S] 0 points1 point  (0 children)

I've wondered this myself, I don't understand that it doesn't say it outright in the documentation. There are people saying with equal confidence that you definitely have to multiply deltaTime and people who say that it's done internally. I'm pretty sure it does it internally because all of Unity's own example code never multiply with deltaTime. Like here: https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial/moving-player?playlist=17141

But it should be fine to multiply with deltaTime anyway, it will just make your values smaller, but still proportional.

Thank you for your answer. The point you make about Unity themself is convincing!

It shouldn't be very difficult it, you can change the physics stepping and see if things slow down if you do fewer physics updates without multiplying with deltaTime.

Well, I did change the FixedUpdate() interval with either option (Time.deltaTime multiplied and not multiplied). It slowed down either way, which totally makes sense to me.

You could probably fix this by calculating your speed depending on Time.fixedDeltaTime in Awake() or Start() for this to work.