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

Allow to apply the angular velocity of a moving platform #63650

Conversation

fabriceci
Copy link
Contributor

@fabriceci fabriceci commented Jul 29, 2022

I thought it was a bug but it was just more a limitation because it's not always wanted. This option adds a layer that allows to indicate if we have to apply or not the angular speed of a platform to the CharacterBody (as for the others)

EDIT: I added as reduz suggested a method to retrieve the angular velocity of the platform.

rotation.mp4

@fabriceci fabriceci added this to the 4.0 milestone Jul 29, 2022
@fabriceci fabriceci requested a review from a team July 29, 2022 20:07
@fabriceci fabriceci requested review from a team as code owners July 29, 2022 20:07
@Diddykonga
Copy link
Contributor

Diddykonga commented Jul 29, 2022

Just making a note, but it seems like this should relate to Velocity On Leave, which is set using a enum, while this which relates to Rotational Velocity is set using layers, which is like how the walls and floors are set.
I'm not sure if Rotation should be like Velocity or vice versa ¯\(ツ)

@fabriceci fabriceci force-pushed the apply-moving-platform-angular-velocity branch from 9836b29 to c7c1b3d Compare July 30, 2022 07:20
@fabriceci
Copy link
Contributor Author

@Diddykonga In fact it's just that rotation is a boolean (yes or no, 2 values), whereas for velocity when leaving the platform there are 3 values (originally there were even more).

@and-rad
Copy link
Contributor

and-rad commented Jul 31, 2022

I'm curious. Can you go into more detail about when it might not be desired for the character to follow the platform's rotation?

I would expect the floor to act like an actual floor and the character to always rotate with it. I think having yet another layer mask for this is pretty inconvenient.

Other than that I think the PR is great and adds a very important feature!

@rburing
Copy link
Member

rburing commented Jul 31, 2022

Would it be possible to do this instead by implementing a get_platform_angular_velocity method?

@fabriceci
Copy link
Contributor Author

@and-rad Nothing specific, I was thinking about vertical rotations (or to make old school FPS)
We can make it a boolean (visible or not in the properties), or always apply it. Opinions are welcome on this.

@rburing The rotation is retrieved with get_angular_velocity, and it is applied in one line of code. I'm not sure I understand.

@reduz
Copy link
Member

reduz commented Aug 11, 2022

@rburing @fabriceci the method that get the velocity at a point does consider the angular velocity, the main problem with this is that most implementations will just rotate the mesh based on the direction and not really the collider or body.

Additionally, since most character control implementations will determine the facing direction based on velocity, this may conflict with it.

IMO, this would probably work better if the user could retrieve this angle after calling move_and_slide and decide what to do with it.

@fabriceci fabriceci force-pushed the apply-moving-platform-angular-velocity branch from c7c1b3d to 3f9db7b Compare August 24, 2022 16:13
@fabriceci
Copy link
Contributor Author

@reduz I added a method get_platform_angular_velocity() as you suggested.

Copy link
Member

@rburing rburing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@akien-mga akien-mga merged commit 151e135 into godotengine:master Jan 3, 2023
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants