MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / SimpleMove

Method SimpleMove

Source/Engine/Physics/Colliders/CharacterController.cpp:165–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165CharacterController::CollisionFlags CharacterController::SimpleMove(const Vector3& speed)
166{
167 const float deltaTime = Time::GetCurrentSafe()->DeltaTime.GetTotalSeconds();
168 Vector3 displacement = speed + _gravityDisplacement;
169 CollisionFlags result = Move(displacement * deltaTime);
170 if ((static_cast<int>(result) & static_cast<int>(CollisionFlags::Below)) != 0)
171 {
172 // Reset accumulated gravity acceleration when we touch the ground
173 _gravityDisplacement = Vector3::Zero;
174 }
175 else
176 _gravityDisplacement += GetPhysicsScene()->GetGravity() * deltaTime;
177 return result;
178}
179
180CharacterController::CollisionFlags CharacterController::Move(const Vector3& displacement)
181{

Callers

nothing calls this directly

Calls 3

GetPhysicsSceneFunction · 0.85
GetGravityMethod · 0.80
MoveFunction · 0.50

Tested by

no test coverage detected