Skip to content

CharacterVirtual in moving and rotating object #395

Answered by jrouwe
DocAce asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

I have the feeling that there's an issue with the velocity calculation:

velocity = Vector3(0.0f, JoltCharacter->GetLinearVelocity().GetY(), 0.0f);

GetLinearVelocity().GetY() will not return the vertical velocity when the ship is rotated, this will:

velocity = Vector3(0.0f, JoltCharacter->GetLinearVelocity().Dot(JoltCharacter->GetUp()), 0.0f);

Also I don't see anything to fix up the character velocity when the ship has rotated during its update, so a better solution is probably:

velocity = Vector3(0.0f, JoltCharacter->GetLinearVelocity().Dot(previous_frame_up_vector), 0.0f);

Where previous_frame_up_vector can simply be gotten before you call JoltCharacter->SetUp(...).

I'm assumin…

Replies: 5 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@DocAce
Comment options

Answer selected by DocAce
Comment options

You must be logged in to vote
3 replies
@jrouwe
Comment options

@jrouwe
Comment options

@jrouwe
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants