Giter VIP home page Giter VIP logo

Comments (13)

chrisspieler avatar chrisspieler commented on August 11, 2024 1

Per Conna's advice, changing the code of ducc 3 so that the player transform is only updated in FixedUpdate fixed the issue. This incorrect code came from the Walker player controller, so that should probably be updated: https://github.com/Facepunch/sbox-walker/blob/main/Libraries/playercontroller/Code/PlayerController.cs

from sbox-issues.

chrisspieler avatar chrisspieler commented on August 11, 2024

This or a similar issue seems to be affecting the game "ducc 3", which uses a mostly unmodified PlayerController library from Facepunch.

from sbox-issues.

yuberee avatar yuberee commented on August 11, 2024

Hope this videos helps displaying the issue.
At first I am moving forward and strafing by tapping A and D.
Then on the way back I just move forward and strafe by moving my mouse.
You can see that on the second attempt the gaps are uneven and sometimes bunched up.
In the video I am noclipping, so just setting the position with Input.AnalogMove * Input.AnalogLook

test.mp4

from sbox-issues.

kurozael avatar kurozael commented on August 11, 2024

With the "noclip" one are you setting the position in FixedUpdate or Update and are you multiplying by Time.Delta? Infact can you just post repro projects it'll make it a lot easier to fix.

from sbox-issues.

yuberee avatar yuberee commented on August 11, 2024

Sure give me one sec I'll set up a repro

from sbox-issues.

yuberee avatar yuberee commented on August 11, 2024

There we go, a shrimple repro.

movementrepro.zip

repro.mp4

from sbox-issues.

andy013 avatar andy013 commented on August 11, 2024

I think when you assign Transform in OnUpdate it clears the interpolated values assigned in OnFixedUpdate without applying them. It's using the old position values.

from sbox-issues.

kurozael avatar kurozael commented on August 11, 2024

I'm gonna say this is currently by design. Here's why:

We automatically interpolate transforms that are set within a Fixed Update context so that movement appears smooth. But, when outside of a Fixed Update context, setting a transform will clear any interpolation and set it to whatever you want it to be immediately.

The problem you're experiencing is not knowing this behavior.

Really you should either do all of your Transform updates in OnFixedUpdate or OnUpdate but mixing both will conflict.

You can see the problem in the repro is resolved by simply moving
Transform.Rotation = Rotation.FromYaw( EyeAngles.yaw );
from OnUpdate to OnFixedUpdate.

from sbox-issues.

johncosfm avatar johncosfm commented on August 11, 2024

Seems like the behavior used to be that setting only rotation in update wouldn't effect the interpolation of position, which seems like it would be the ideal behavior, any chance we could get that back? It isn't very intuitive that setting rotation would fuck up position

from sbox-issues.

yuberee avatar yuberee commented on August 11, 2024

That makes sense, although I see a lot of people encountering this in the future.
I'll make sure to go over it in future tutorials as my current ones use the old method.

from sbox-issues.

kurozael avatar kurozael commented on August 11, 2024

Don't just yet - nothing is final - I want to find the right balance for all the use cases and for it to feel intuitive.

from sbox-issues.

andy013 avatar andy013 commented on August 11, 2024

What are the use cases for wanting to set rotation in OnUpdate and position in OnFixedUpdate? Wouldn't setting both in OnFixedUpdate and interpolating achieve the same result?

from sbox-issues.

johncosfm avatar johncosfm commented on August 11, 2024

Generally games have player movement code (dealing with position) in fixed update, but camera movement has to be in update to avoid it feeling floaty. My project had the position of the camera gameobject set in fixedupdate by the ducking logic and the rotation set in update by the mouse look logic. Now I have 2 gameobjects, one dealing with position set in FixedUpdate and the other dealing with rotation set in update (which works fine but I don't think I would have ever thought to do it without seeing the comments here)
image

from sbox-issues.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.