Updated the out-of-bounds reset
- Now resets to initial position, and not a random one.
This commit is contained in:
parent
b3b270ae67
commit
1372ac4a6b
|
@ -20,7 +20,8 @@ KartPhysicsComponent::KartPhysicsComponent(mat4 transform,
|
|||
physicsSystem,
|
||||
physicsCollisionSubSystem,
|
||||
physicsColliderQuerySubSystem,
|
||||
collider)
|
||||
collider),
|
||||
mInitialTransform(transform)
|
||||
{}
|
||||
|
||||
KartPhysicsComponent::~KartPhysicsComponent()
|
||||
|
@ -33,9 +34,8 @@ void KartPhysicsComponent::update(const milliseconds dtms)
|
|||
|
||||
if (getPosition().y < -100.0f)
|
||||
{
|
||||
setPosition(vec3(getFloatInRange(-10.0f, 10.0f),
|
||||
10, /// above the ball
|
||||
getFloatInRange(-10.0f, 10.0f)));
|
||||
setPosition(vec3(0, 0, 0), true);
|
||||
setTransform(mInitialTransform);
|
||||
}
|
||||
|
||||
if (glm::length(mDirection) > 0)
|
||||
|
|
|
@ -77,6 +77,7 @@ class KartPhysicsComponent:
|
|||
{
|
||||
private:
|
||||
vec3 mDirection;
|
||||
mat4 mInitialTransform; ///< Used for reset.
|
||||
|
||||
public:
|
||||
KartPhysicsComponent(mat4 transform,
|
||||
|
|
Loading…
Reference in New Issue