Question in the Spit & Polish lecture of Section 3: Project Boost

Hello Nina I have the same problem as described in the post here. Can you help me

When I write the same code as ben did then it falls slowly.

But I found a solution to this which is shown below

I just want to know why Ben’s Solution worked for him but not for me.

Hi,

Welcome to our community! :slight_smile:

Please note, it’s better to copy/paste your code and apply the code fencing characters, rather than using screenshots. Screenshots are ideal for displaying specific details from within a game engine editor or even error messages, but for code, they tend to be less readable, especially on mobile devices which can require extensive zooming and scrolling.

You also prevent those that may offer to help you the ability to copy/paste part of your code back to you with suggestions and/or corrections, meaning that they would need to type a potentially lengthy response. You will often find that people are more likely to respond to your questions if you make it as easy as possible for them to do so.

I don’t see any difference between the two solutions except for the position of rb.angularVelocity. I’m surprised that the second solution works but the first one doesn’t.


See also;

Well I was going to paste code but I thought picture would be great. But I got your point and I will keep that in mind. Now in the first example rb.angularVelocity will be set to zero every single frame so why is it working for Ben? I think it shouldn’t. In the second one rb.angularVelocity will only be zero if we press A or D. What are your thoughts about it?

As aforementioned, I’m surprised that Ben’s solution does not work because when none of the if/else if blocks get executed, the angularVelocity could have a different value than 0.

It’s just a theory but I suspect that the bug occurs due to an imbalance in the “architecture” of our rocket. Since the pivot point is the reference point for all calculations regarding a game object, it must be located exactly in the centre of all colliders. Furthermore, the colliders must be mirrored on both/all four sides. If one of them is slightly off, the rocket could tilt. The tilting speed depends on the angularVelocity, which increases due to the gravity. That’s why Ben’s solution is supposed to work. At least, it should be working in theory.

This topic was automatically closed after 13 days. New replies are no longer allowed.

Privacy & Terms