Offset by 8 units

Hi guys.

When making the paddle follow the mouse I followed your script but for some reason I have an offset of +8 units. I went through all my elements’ inspectors to see whether I have maybe added an offset somewhere. that was not the case. Here’re the code and what it looks like in Unity (the cursor hovering over the little square):


I solved it by adding a “- 8f” to the mix. But it feels like cheating. :smiley:


Anybody got a hint for me where the offset might come from?

Thanks and happy coding!

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.

Regarding your problem, is the camera position set to (8, 6, -10)?

Hope this helps :slight_smile:


See also;

1 Like

Hey Nina!
Thanks for the tip. I’ll keep that in mind.

Regarding my problem: My camera is set to (0, 0, -10)

Please set its position to (8, 6, -10).

1 Like

Just an idea: have you somehow opened your Paddle in the sprite editor, and changed the Pivot-Point to bottom left? :thinking:

We had to do that with the background image, so maybe you did it for the paddle aswell?

1 Like

@Nina If I do that then my whole game is gone and I have to relocate all the assets. That doesn’t feel right.

@Christian_Bude Thanks for the advice. I didn’t open it in the sprite editor before. Just now to double-check the pivot. It’s all nice and dandy there.

@Nina I ended up changing the cam to your setting and relocating my assets… Thanks for the tip. :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms