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

[BUG] Banking turns disables while flapping #120

Open
Happyrobot33 opened this issue Nov 12, 2024 · 1 comment
Open

[BUG] Banking turns disables while flapping #120

Happyrobot33 opened this issue Nov 12, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Happyrobot33
Copy link
Collaborator

When you trigger a flap, any banking turning you were doing will be paused until the flap action is finished. This seems to be related to this line here

else // Not in a gliding pose?
{
isGliding = false;
rotSpeedGoal = 0;
glideDelay = 0;
}

When rotSpeedGoal is set to 0, rotation wont happen in update()

if (spinningRightRound)
{
// Avatar modifiers affect spin speed
float weightMod = useAvatarModifiers ? (1 - (weight - 1)) : 1;
rotSpeed += (rotSpeedGoal - rotSpeed) * Time.deltaTime * 6 * weightMod;
// --- BEGIN MACKANDELIUS NO-JITTER BANKING TURNS FIX ---
//Playspace origin and actual player position seems to work as parent and child objects,
//therefore the conclusion is that we must make the playspace origin orbit the player.
//
//Caching positional data and modifying a virtual origin to be translated.
VRCPlayerApi.TrackingData trackingData = LocalPlayer.GetTrackingData(VRCPlayerApi.TrackingDataType.Origin);
loadBearingTransform.position = trackingData.position;
loadBearingTransform.rotation = trackingData.rotation;
Vector3 playerPos = LocalPlayer.GetPosition();
//This function is strange.
//I am in awe of the Unity engineers that had to fix the edge case of someone wanting to rotate the parent around a child.
//Sure is useful in this case though.
loadBearingTransform.RotateAround(playerPos, Vector3.up, rotSpeed * Time.deltaTime);
//Teleport based on playspace position, with an offset to place the player at the teleport location instead of the playspace origin.
LocalPlayer.TeleportTo(
playerPos + (loadBearingTransform.position - playerPos),
loadBearingTransform.rotation,
VRC_SceneDescriptor.SpawnOrientation.AlignRoomWithSpawnPoint,
true
);
// --- END FIX ---
}

rotSpeedGoal being set to 0 seems to erroneously happen as the if statement its captured by is checking for flaps as part of its conditions
// Check for a gliding pose
// Verbose explanation: (Ensure you're not flapping) && (check for handsOut frame one, ignore handsOut afterwards) && Self Explanatory && Ditto
if ((!isFlapping) && (isGliding || handsOut) && handsOpposite && canGlide)
{
// Currently, glideDelay is being disabled to alleviate a VRChat issue where avatars may spazz out while moving at high velocities.
// However, this may reintroduce an old bug so we're keeping this here.
// If gliding is suddenly causing you to bank up and down rapidly, uncomment this:
// if (LocalPlayer.GetVelocity().y > -1f && (!isGliding)) {glideDelay = 3;}

@Happyrobot33 Happyrobot33 added the bug Something isn't working label Nov 12, 2024
@Happyrobot33
Copy link
Collaborator Author

Need to check back in on this upcoming school term

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