Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source position may be modified #153

Open
fight4dream opened this issue Dec 14, 2021 · 8 comments
Open

Source position may be modified #153

fight4dream opened this issue Dec 14, 2021 · 8 comments
Labels
bug Something isn't working

Comments

@fight4dream
Copy link

Environment

  • Code source: tilia psuedo body
  • Code version: 36fdc67
  • Platform version: Unity 2019.4.17f1

Steps to reproduce

  1. new scene, add TrackedAlias and any camera rigs
  2. create empty child under HeadsetAlias, name it HeadJoint, position (0, -0.1, -0.12)
  3. create a cube, name it Floor, position (0, -5, 0), scale (10, 10, 10)
  4. create a cube, name it Lava, set layer Water, position (0, -7, 0), scale (10, 10, 10), use a material to make it red
  5. add PseudoBody, set Source = HeadJoint, Offset = PlayAreaAlias
    image
  6. in PseudoBody/CollidableVolume:CollisionTracker.CollisionStarted, we'll make it detect collision with Lava
    image
  7. the screen caps that follows are equivalent to the pseudo code:
public void ResetIfLava(...)
{
    if (collided with Lava)
    {
        PseudoBody.SetActive(false);
        Vector3 position = PlayAreaAlias.transform.position;
        position.y = 0;
        PlayAreaAlias.transform.position = position;
        Floor.SetActive(true);
        yield return new WaitForEndOfFrame();
        PseudoBody.SetActive(true);
    }
}

image
image
image
image
image

  1. play the scene, deactivate Floor, player/pseudobody should fall onto Lava, and it will trigger the above procedure to teleport the player back to the Floor

Expected behavior

After the teleport, the HeadJoint should still be at position (0, -0.1, -0.12).

Current behavior

After the teleport, the HeadJoint is moved.
image

@thestonefox
Copy link
Member

What if the setup doesn't even have the psuedobody in play?

The headjoint is part of the tracked alias, and the movement is being caused by the teleporter.

The pseudobody code does not alter the position of the source, only the character controller (as far as I can see).

I'd recommend simplifying the steps to reproduce as there could be a number of points where an issue is being introduced by the steps involved right now.

@fight4dream
Copy link
Author

  1. new scene, add TrackedAlias and any camera rigs
  2. create empty child under HeadsetAlias, name it HeadJoint, position (0, -0.1, -0.12)
  3. the screen caps that follow are equivalent to the pseudo code:
{
        Vector3 position = PlayAreaAlias.transform.position;
        position.y = 0;
        PlayAreaAlias.transform.position = position;
}

image
4. add a Input manager button action to make the teleport happen when 'spacebar' is pressed
image
5. play the scene, drag the PlayAreaAlias down to simulate the original pseudo body falling down, observe the HeadJoint is still at position (0, -0.1, -0.12).
6. press 'spacebar' to teleport. Observe the HeadJoint is still at position (0, -0.1, -0.12).

cannot reproduce the HeadJoint position modified issue with these steps.

@thestonefox please advise for the next test.

@fight4dream
Copy link
Author

fight4dream commented Dec 22, 2021

  1. new scene, add TrackedAlias and any camera rigs
  2. create empty child under HeadsetAlias, name it HeadJoint, position (0, -0.1, -0.12)
  3. create a cube, name it Floor, position (0, -5, 0), scale (10, 10, 10)
  4. add PseudoBody, set Source = HeadJoint, Offset = PlayAreaAlias
  5. play the scene, now drag the Floor down, PseudoBody (and playarea) should fall down onto new floor position.

Observe that the the HeadJoint position is modified. Also notice that its position may be constantly being updated due to some floating point error

PS. I just checked the code, PseudoBodyProcessor will change Facade.Source.transform.position (line 185, 201, 275)

@thestonefox
Copy link
Member

yeah I can recreate with those, good spot on the processor line, i'll see whats going on

@thestonefox thestonefox added the bug Something isn't working label Dec 22, 2021
@thestonefox
Copy link
Member

it's a bit odd that it changes the source position, because usually that is the headset alias which is being kept in sync with the actual headset, so changing the position of it doesn't really affect anything.

But obviously in this regard it is causing an issue. I'm not entirely sure why the source is changed at all.

@thestonefox
Copy link
Member

What about something just like this?

#154

you can just untick the update source position bool?

@fight4dream
Copy link
Author

confirmed #154 in this situation the source HeadJoint position is not modified.
however, in what situations do we need to modify the source position?

@thestonefox
Copy link
Member

I don't know why the source position is modified, chris wrote the psuedo body stuff originally and I'm struggling to think of a time when you'd need to modify it. I remember there was something about you could use it without vr stuff and in those instances it probably makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants